1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-08-05 15:47:25 +02:00

Re-implement method 'canResetPassword' using 'canResetPasswordOrThrow'

This commit is contained in:
Marco
2018-03-10 04:13:14 +01:00
parent 1ba8e1ff21
commit 9478a43e9b

View File

@@ -1250,18 +1250,10 @@ final class Auth extends UserManager {
*/
public function canResetPassword($selector, $token) {
try {
// pass an invalid password intentionally to force an expected error
$this->resetPassword($selector, $token, null);
$this->canResetPasswordOrThrow($selector, $token);
// we should already be in the `catch` block now so this is not expected
throw new AuthError();
}
// if the password is the only thing that's invalid
catch (InvalidPasswordException $e) {
// the password can be reset
return true;
}
// if some other things failed (as well)
catch (AuthException $e) {
return false;
}