/** * {@inheritdoc} */ public function validatePassword(UserInterface $user, $password) { $hash = $user->getPassword(); // Check if the provided password is valid $isValid = Password::validate($password, $hash); // Check if the password needs to be rehashed IF the provided password is valid if ($isValid && Password::needsRehash($hash)) { $user->setPassword($password); $user->save(); } // Return validation result return $isValid; }
/** * Resets the login throttling. * * @access public * @param \mako\auth\user\UserInterface $user User object * @return boolean */ public function resetThrottle(UserInterface $user) { if ($user->getFailedAttempts() > 0) { $user->resetFailedAttempts(); $user->unlock(); return $user->save(); } return true; }