Permalink
Browse files

Make authdemo's logout less confusing.

Closes #376.
  • Loading branch information...
1 parent 8dc3a5d commit 4386f1b0888a5c4a90f5918f547f30ecb42a4baa @bdarnell bdarnell committed Aug 26, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 demos/auth/authdemo.py
View
@@ -62,17 +62,24 @@ def get(self):
self.get_authenticated_user(self.async_callback(self._on_auth))
return
self.authenticate_redirect()
-
+
def _on_auth(self, user):
if not user:
raise tornado.web.HTTPError(500, "Google auth failed")
self.set_secure_cookie("user", tornado.escape.json_encode(user))
self.redirect("/")
+
class LogoutHandler(BaseHandler):
def get(self):
+ # This logs the user out of this demo app, but does not log them
+ # out of Google. Since Google remembers previous authorizations,
+ # returning to this app will log them back in immediately with no
+ # interaction (unless they have separately logged out of Google in
+ # the meantime).
self.clear_cookie("user")
- self.redirect("/")
+ self.write('You are now logged out. '
+ 'Click <a href="/">here</a> to log back in.')
def main():
tornado.options.parse_command_line()

0 comments on commit 4386f1b

Please sign in to comment.