@gen.coroutine
def ValidateUserPassword(client, user, password):
 assert (user is not None), 'user should exist in login case'
 if (user.pwd_hash is None):
  raise PermissionError(_NO_PASSWORD_SET)
 assert user.salt, user
 user_salt = user.salt.Decrypt()
 user_pwd_hash = user.pwd_hash.Decrypt()
 (yield ValidatePassword(client, user.user_id, password, user_salt, user_pwd_hash))

@ gen . coroutine def ValidateUserPassword ( client , user , password ) : assert ( user is not None ) , 'user should exist in login case' if ( user . pwd_hash is None ) : raise PermissionError ( _NO_PASSWORD_SET ) assert user . salt , user user_salt = user . salt . Decrypt ( ) user_pwd_hash = user . pwd_hash . Decrypt ( ) ( yield ValidatePassword ( client , user . user_id , password , user_salt , user_pwd_hash ) )
validates that the users password matches the given password and that the maximum incorrect guess count has not been reached .