Swap if / elseif
https://github.com/friendica/friendica/pull/4782#discussion_r179947984
This commit is contained in:
parent
82f1f2f00e
commit
e860cdf6a8
|
@ -127,18 +127,18 @@ class User
|
||||||
{
|
{
|
||||||
$user = self::getAuthenticationInfo($user_info);
|
$user = self::getAuthenticationInfo($user_info);
|
||||||
|
|
||||||
if (password_verify($password, $user['password'])) {
|
if (strpos($user['password'], '$') === false) {
|
||||||
if (password_needs_rehash($user['password'], PASSWORD_DEFAULT)) {
|
|
||||||
self::updatePassword($user['uid'], $password);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $user['uid'];
|
|
||||||
} elseif (strpos($user['password'], '$') === false) {
|
|
||||||
if (self::hashPasswordLegacy($password) === $user['password']) {
|
if (self::hashPasswordLegacy($password) === $user['password']) {
|
||||||
self::updatePassword($user['uid'], $password);
|
self::updatePassword($user['uid'], $password);
|
||||||
|
|
||||||
return $user['uid'];
|
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'));
|
throw new Exception(L10n::t('Login failed'));
|
||||||
|
|
Loading…
Reference in a new issue