def auth_user_db(self, username, password):
if username is None or username == "<STR_LIT>":<EOL><INDENT>return None<EOL><DEDENT>user = self.find_user(username=username)<EOL>if user is None:<EOL><INDENT>user = self.find_user(email=username)<EOL><DEDENT>if user is None or (not user.is_active):<EOL><INDENT>log.info(LOGMSG_WAR_SEC_LOGIN_FAILED.format(username))<EOL>return None<EOL><DEDENT>elif check_password_hash(user.password, password):<EOL><INDENT>self.update_user_auth_stat(user, True)<EOL>return user<EOL><DEDENT>else:<EOL><INDENT>self.update_user_auth_stat(user, False)<EOL>log.info(LOGMSG_WAR_SEC_LOGIN_FAILED.format(username))<EOL>return None<EOL><DEDENT>
Method for authenticating user, auth db style

:param username:
    The username or registered email address
:param password:
    The password, will be tested against hashed password on db