Exemplo n.º 1
0
 def get_user(self):
     session_string = self.request.cookies.get('user_id')
     if session_string:
         if utils.valid_cookie_hash(session_string):
             session_hash, user_id = session_string.split("|")
             user = models.get_user_by_id(int(user_id))
             return user
     return None
Exemplo n.º 2
0
 def get(self):
     username = "******"
     user_hash = self.request.cookies.get('user_id')
     if user_hash:
         user_id = utils.valid_cookie_hash(user_hash)
         if user_id and user_id.isdigit():
             user_obj = model_users.Users.get_by_id(int(user_id))
             if user_obj:
                 username = user_obj.username
         else:
             # cookie validation failed!  redirect to logon page!
             self.redirect(URL_SIGNUP)
             
         
     self.render('signup_confirm_page.html', username=username)
     
Exemplo n.º 3
0
 def read_secure_cookie(self, name):
     cookie_val = self.request.cookies.get(name)
     return cookie_val and utils.valid_cookie_hash(cookie_val)