diff options
author | minstel <minstel@yandex.ru> | 2015-12-24 16:43:38 +0200 |
---|---|---|
committer | minstel <minstel@yandex.ru> | 2015-12-24 16:43:38 +0200 |
commit | b5fbfa9fa12c7cd410ddf2f3d672804849c70b3c (patch) | |
tree | 3a5312d6acd58e3aa2e8e6e80aeb1bc3b973e16e | |
parent | 7ed5839dcb9a3147a89a5106e42699350c8b3011 (diff) | |
download | auth-b5fbfa9fa12c7cd410ddf2f3d672804849c70b3c.zip auth-b5fbfa9fa12c7cd410ddf2f3d672804849c70b3c.tar.gz auth-b5fbfa9fa12c7cd410ddf2f3d672804849c70b3c.tar.bz2 |
Fixes to Auth::generateConfirmationHash() and Auth::fetchForPasswordReset()
-rw-r--r-- | src/Jasny/Auth.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Jasny/Auth.php b/src/Jasny/Auth.php index 17f5312..139e282 100644 --- a/src/Jasny/Auth.php +++ b/src/Jasny/Auth.php @@ -186,12 +186,12 @@ abstract class Auth implements Fetching /** * Generate a confirmation hash * - * @param User $user + * @param User|int $user * @return string */ public static function generateConfirmationHash($user) { - $id = $user->getId(); + $id = is_object($user) ? $user->getId() : $user; return sprintf('%010s', substr(base_convert(md5($id . static::getSecret()), 16, 36), -10) . base_convert($id, 10, 36)); @@ -237,7 +237,7 @@ abstract class Auth implements Fetching $id = base_convert(substr($hash, 10), 36, 10); $user = static::fetchUserById($id); - if (!$user || static::generatePasswordResetHash($id, $user->getPassword()) != $hash) return null; // invalid hash + if (!$user || static::generatePasswordResetHash($user) != $hash) return null; // invalid hash return $user; } |