From e860cdf6a8769c8441ed3dba33f192898c78ab40 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 8 Apr 2018 16:02:25 +0200 Subject: [PATCH] Swap if / elseif https://github.com/friendica/friendica/pull/4782#discussion_r179947984 --- src/Model/User.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Model/User.php b/src/Model/User.php index 6178906aa2..27f7ff66f7 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -127,18 +127,18 @@ class User { $user = self::getAuthenticationInfo($user_info); - if (password_verify($password, $user['password'])) { - if (password_needs_rehash($user['password'], PASSWORD_DEFAULT)) { - self::updatePassword($user['uid'], $password); - } - - return $user['uid']; - } elseif (strpos($user['password'], '$') === false) { + if (strpos($user['password'], '$') === false) { if (self::hashPasswordLegacy($password) === $user['password']) { self::updatePassword($user['uid'], $password); return $user['uid']; } + } elseif (password_verify($password, $user['password'])) { + if (password_needs_rehash($user['password'], PASSWORD_DEFAULT)) { + self::updatePassword($user['uid'], $password); + } + + return $user['uid']; } throw new Exception(L10n::t('Login failed')); -- 2.39.5