#NEWLINE# def auth_user_db( self , username , password ) : #NEWLINE# #INDENT# '\n            Method for authenticating user, auth db style\n\n            :param username:\n                The username\n            :param password:\n                The password, will be tested against hashed password on db\n        ' #NEWLINE# if ( ( username is None ) or ( username == '' ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# user = self . find_user ( username = username ) #NEWLINE# if ( ( password is None ) or ( not user . is_active ( ) ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if check_password_hash ( user . password , password ) : #NEWLINE# #INDENT# self . update_user_auth_stat ( user , True ) #NEWLINE# return user #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . update_user_auth_stat ( user , False ) #NEWLINE# return None