Apply suggestions from code review
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
parent
eb1b2256a0
commit
b60c342a8f
|
@ -239,11 +239,9 @@ function api_login(App $a)
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$user_id = User::getIdFromPasswordAuthentication(trim($user), trim($password), true);
|
$user_id = User::getIdFromPasswordAuthentication(trim($user), trim($password), true);
|
||||||
if ($user_id !== false) {
|
$record = DBA::selectFirst('user', [], ['uid' => $user_id]);
|
||||||
$record = DBA::selectFirst('user', [], ['uid' => $user_id]);
|
} catch (Exception $ex) {
|
||||||
}
|
$record = [];
|
||||||
} catch (Exception $ex) {
|
|
||||||
$record = [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,12 +309,8 @@ function settings_post(App $a)
|
||||||
if ($email != $user['email']) {
|
if ($email != $user['email']) {
|
||||||
// check for the correct password
|
// check for the correct password
|
||||||
try {
|
try {
|
||||||
$authenticated = User::getIdFromPasswordAuthentication(intval(local_user()), $_POST['mpassword']);
|
User::getIdFromPasswordAuthentication(local_user(), $_POST['mpassword']);
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
$authenticated = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$authenticated) {
|
|
||||||
$err .= DI::l10n()->t('Wrong Password.');
|
$err .= DI::l10n()->t('Wrong Password.');
|
||||||
$email = $user['email'];
|
$email = $user['email'];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue