mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-04 23:27:28 +02:00
Do not validate password earlier than necessary
This commit is contained in:
@@ -771,7 +771,6 @@ class Auth {
|
||||
*/
|
||||
private function authenticateUserInternal($password, $email, $rememberDuration = null) {
|
||||
$email = self::validateEmailAddress($email);
|
||||
$password = self::validatePassword($password);
|
||||
|
||||
try {
|
||||
$userData = $this->db->selectRow(
|
||||
@@ -784,6 +783,8 @@ class Auth {
|
||||
}
|
||||
|
||||
if (!empty($userData)) {
|
||||
$password = self::validatePassword($password);
|
||||
|
||||
if (password_verify($password, $userData['password'])) {
|
||||
// if the password needs to be re-hashed to keep up with improving password cracking techniques
|
||||
if (password_needs_rehash($userData['password'], PASSWORD_DEFAULT)) {
|
||||
|
Reference in New Issue
Block a user