]> git.mxchange.org Git - friendica.git/commitdiff
Apply suggestions from code review
authorMichael Vogel <icarus@dabo.de>
Sun, 7 Nov 2021 15:45:36 +0000 (16:45 +0100)
committerGitHub <noreply@github.com>
Sun, 7 Nov 2021 15:45:36 +0000 (16:45 +0100)
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
include/api.php
mod/settings.php

index 062865d4398eba43ed1a4fbf29692e4de387f86a..68723a0f428c598b8f2a175536fd839dd142fe90 100644 (file)
@@ -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 = [];
                }
        }
 
index e42760358cd8ac76c8d3e16f8fb8f272fcc59a18..080bcdeb93848a7cc086c60798583752a3b17be3 100644 (file)
@@ -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'];
                }