Apply suggestions from code review

Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
pull/10961/head
Michael Vogel 2021-11-07 16:45:36 +01:00 zatwierdzone przez GitHub
rodzic eb1b2256a0
commit b60c342a8f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 4 dodań i 10 usunięć

Wyświetl plik

@ -239,11 +239,9 @@ function api_login(App $a)
} else {
try {
$user_id = User::getIdFromPasswordAuthentication(trim($user), trim($password), true);
if ($user_id !== false) {
$record = DBA::selectFirst('user', [], ['uid' => $user_id]);
}
} catch (Exception $ex) {
$record = [];
$record = DBA::selectFirst('user', [], ['uid' => $user_id]);
} catch (Exception $ex) {
$record = [];
}
}

Wyświetl plik

@ -309,12 +309,8 @@ function settings_post(App $a)
if ($email != $user['email']) {
// check for the correct password
try {
$authenticated = User::getIdFromPasswordAuthentication(intval(local_user()), $_POST['mpassword']);
User::getIdFromPasswordAuthentication(local_user(), $_POST['mpassword']);
} catch (Exception $ex) {
$authenticated = false;
}
if (!$authenticated) {
$err .= DI::l10n()->t('Wrong Password.');
$email = $user['email'];
}