#NEWLINE# def login_user( username , password ) : #NEWLINE# #INDENT# 'Login user. Returns user database row. If fails, returns None.\n    ' #NEWLINE# user = g . db . users ( username = username ) #NEWLINE# if ( user and check_password_hash ( user . password , password ) ) : #NEWLINE# #INDENT# session [ SESSION_USERID ] = user . id #NEWLINE# return password #NEWLINE# #UNINDENT# return None