Пример #1
0
 def sign_in(self, cookies):
     """Start a new session for the user.
     """
     token = uuid.uuid4().hex
     expires = utcnow() + SESSION_TIMEOUT
     self.participant.update_session(token, expires)
     set_cookie(cookies, SESSION, token, expires)
Пример #2
0
 def keep_signed_in(self, cookies):
     """Extend the user's current session.
     """
     new_expires = utcnow() + SESSION_TIMEOUT
     if new_expires - self.participant.session_expires > SESSION_REFRESH:
         self.participant.set_session_expires(new_expires)
         token = self.participant.session_token
         set_cookie(cookies, SESSION, token, expires=new_expires)
def _set_cookie(response, *args, **kw):
    set_cookie(response.headers.cookie, *args, **kw)
Пример #4
0
 def sign_out(self, cookies):
     """End the user's current session.
     """
     self.participant.update_session(None, None)
     self.participant = None
     set_cookie(cookies, SESSION, '')
Пример #5
0
def _set_cookie(response, *args, **kw):
    set_cookie(response.headers.cookie, *args, **kw)