Advertisement
Guest User

Untitled

a guest
Feb 11th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # Grabs cookie and splits the first part to it's user_id from the datastore (Ex: 747474)
  2. user_id_cookie_str = user_cookie_str.split('|')[0]
  3.  
  4. # Grabs cookie and splits the second part to it's hash from the datastre (Ex: fj78df87dd87d78)
  5. user_hash_cookie_str = user_cookie_str.split('|')[1]
  6.  
  7. # Goes into User table selects the column password and checks to see if pass is equal to hash from the cookie
  8. get_username = db.GqlQuery("SELECT * FROM User WHERE id=:user_id and password = :user_pass",
  9. (user_id=user_id_cookie_str, user_pass=user_hash_cookie_str))
  10.  
  11. # Fetches every data from the specific user
  12. if get_username.count():
  13. # Get users username and render the welcome page
  14. if get_username.get().username:
  15. username_from_db = get_username.get().username
  16. self.render("welcome.html", username=username_from_db)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement