-
Notifications
You must be signed in to change notification settings - Fork 430
Fix flask required decorator to redirect on expired credentials. #452
Fix flask required decorator to redirect on expired credentials. #452
Conversation
/r @dhermes or @nathanielmanistaatgoogle @elibixby ran into this in his application. Apparently I was mistaken in just checking @waprin a similar change is probably need to the django helper. |
acknowledged, I'll take a look at Django. |
|
||
response = client.get('/protected') | ||
self.assertEqual(response.status_code, httplib.OK) | ||
self.assertTrue('Hello' in response.data.decode('utf-8')) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Thanks for the review, just FYI I won't be able to fix the few nits for a few days. Will ping when ready. |
861cc4b
to
3a30e21
Compare
Comments addressed. |
LoL Python 2.6. You need to swap out for |
3a30e21
to
a5e0223
Compare
ugh. Fixed. |
|
||
response = client.get('/protected') | ||
self.assertEqual(response.status_code, httplib.FOUND) | ||
self.assertTrue('oauth2authorize' in response.headers['Location']) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
a5e0223
to
1966a6f
Compare
@nathanielmanistaatgoogle all of the instances |
1966a6f
to
947997c
Compare
@@ -443,7 +443,12 @@ def credentials(self): | |||
|
|||
def has_credentials(self): | |||
"""Returns True if there are valid credentials for the current user.""" | |||
return self.credentials and not self.credentials.invalid | |||
if not self.credentials: | |||
return False |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
947997c
to
98e2899
Compare
if not self.credentials: | ||
return False | ||
# Is the access token expired? If so, do we have an refresh token? | ||
if (self.credentials.access_token_expired |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
98e2899
to
a82146a
Compare
Looks good; waiting on fresh test results. |
Fix flask required decorator to redirect on expired credentials.
Thanks. :) On Fri, Mar 11, 2016 at 1:53 PM Nathaniel Manista notifications@github.com
|
No description provided.