Last active
January 23, 2017 01:08
-
-
Save LuqiPan/13561825bc431e5c8facf7d2fe51a189 to your computer and use it in GitHub Desktop.
Log Driven Development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def login(login, password): | |
"""This function tries to log the user in and populate the session | |
Args: | |
login (str): The login of the user | |
password (str): The (hashed) password of the user | |
Returns: | |
bool: The result of login. True for success, False otherwise | |
""" | |
user = fetch_user(login, password) | |
if not user: | |
return False | |
request.session['id'] = user.id | |
# TODO (1/1/2003): implement a better way to handle VIP users | |
if request.POST['VIP_KEY'] == '5fa3e7a21e34714b44720836573a71ce': | |
request.session['is_vip'] = True | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment