from werkzeug.security import safe_str_cmp
from models.user import UserModel

def authenticate(username, password):
	# the following is alternate syntax for username_mapping[username], where 
	# you can return None if the username is not found
	user = UserModel.find_by_username(username)
	if user and safe_str_cmp(user.password, password):
		return user

def identity(payload):
	user_id = payload['identity']
	return UserModel.find_by_id(user_id)

87c31293d6f3365714888c1f7a09c7e2b8638a47
<mask token>

<mask token>


def authenticate(username, password):
    user = UserModel.find_by_username(username)
    if user and safe_str_cmp(user.password, password):
        return user


<mask token>

<mask token>


def authenticate(username, password):
    user = UserModel.find_by_username(username)
    if user and safe_str_cmp(user.password, password):
        return user


def identity(payload):
    user_id = payload['identity']
    return UserModel.find_by_id(user_id)

from werkzeug.security import safe_str_cmp
from models.user import UserModel


def authenticate(username, password):
    user = UserModel.find_by_username(username)
    if user and safe_str_cmp(user.password, password):
        return user


def identity(payload):
    user_id = payload['identity']
    return UserModel.find_by_id(user_id)

from werkzeug.security import safe_str_cmp
from models.user import UserModel

def authenticate(username, password):
	# the following is alternate syntax for username_mapping[username], where 
	# you can return None if the username is not found
	user = UserModel.find_by_username(username)
	if user and safe_str_cmp(user.password, password):
		return user

def identity(payload):
	user_id = payload['identity']
	return UserModel.find_by_id(user_id)
