From 4386f1b0888a5c4a90f5918f547f30ecb42a4baa Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 26 Aug 2012 16:23:30 -0700 Subject: [PATCH] Make authdemo's logout less confusing. Closes #376. --- demos/auth/authdemo.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/demos/auth/authdemo.py b/demos/auth/authdemo.py index 0196a3be7..cca7d3786 100755 --- a/demos/auth/authdemo.py +++ b/demos/auth/authdemo.py @@ -62,17 +62,24 @@ class AuthHandler(BaseHandler, tornado.auth.GoogleMixin): 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 here to log back in.') def main(): tornado.options.parse_command_line() -- 2.47.2