Пример #1
0
    def test_returning_user_can_log_in_automatically(self):
        stub_request = mock.Mock()
        username = '******'

        cookie = auth.log_in_as_user(stub_request, username)

        assert auth.check_login_cookie(cookie) == (username, True)
Пример #2
0
 def token_login(self, cookie):
     username, ok = auth.check_login_cookie(cookie)
     if ok:
         auth.forget_login_cookie(cookie)
         self.logger.info("User %s logging in (via token).", username)
         self.do_login(username)
     else:
         self.logger.warning("Wrong login token for user %s.", username)
         self.send_message("login_fail")