Skip to content

Commit 4386f1b

Browse files
committed
Make authdemo's logout less confusing.
Closes tornadoweb#376.
1 parent 8dc3a5d commit 4386f1b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

demos/auth/authdemo.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,24 @@ def get(self):
6262
self.get_authenticated_user(self.async_callback(self._on_auth))
6363
return
6464
self.authenticate_redirect()
65-
65+
6666
def _on_auth(self, user):
6767
if not user:
6868
raise tornado.web.HTTPError(500, "Google auth failed")
6969
self.set_secure_cookie("user", tornado.escape.json_encode(user))
7070
self.redirect("/")
7171

72+
7273
class LogoutHandler(BaseHandler):
7374
def get(self):
75+
# This logs the user out of this demo app, but does not log them
76+
# out of Google. Since Google remembers previous authorizations,
77+
# returning to this app will log them back in immediately with no
78+
# interaction (unless they have separately logged out of Google in
79+
# the meantime).
7480
self.clear_cookie("user")
75-
self.redirect("/")
81+
self.write('You are now logged out. '
82+
'Click <a href="/">here</a> to log back in.')
7683

7784
def main():
7885
tornado.options.parse_command_line()

0 commit comments

Comments
 (0)