Passed
Pull Request — main (#5039)
by
unknown
17:52
created
app/Services/UserService.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -320,7 +320,7 @@
 block discarded – undo
320 320
             'real_name' => $real_name,
321 321
             'email'     => $email,
322 322
             'password'  => password_hash($password, PASSWORD_DEFAULT),
323
-	    'secret'    => $secret,
323
+        'secret'    => $secret,
324 324
         ]);
325 325
 
326 326
         $user_id = DB::lastInsertId();
Please login to merge, or discard this patch.
app/Http/RequestHandlers/AccountUpdate.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
         $language       = Validator::parsedBody($request)->string('language');
68 68
         $real_name      = Validator::parsedBody($request)->string('real_name');
69 69
         $password       = Validator::parsedBody($request)->string('password');
70
-	$secret         = Validator::parsedBody($request)->string('secret');
70
+    $secret         = Validator::parsedBody($request)->string('secret');
71 71
         $time_zone      = Validator::parsedBody($request)->string('timezone');
72 72
         $user_name      = Validator::parsedBody($request)->string('user_name');
73 73
         $visible_online = Validator::parsedBody($request)->boolean('visible-online', false);
74
-	$status_mfa = Validator::parsedBody($request)->boolean('status-mfa', '0');
74
+    $status_mfa = Validator::parsedBody($request)->boolean('status-mfa', '0');
75 75
 
76 76
         // Change the password
77 77
         if ($password !== '') {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $user->setPreference(UserInterface::PREF_LANGUAGE, $language);
105 105
         $user->setPreference(UserInterface::PREF_TIME_ZONE, $time_zone);
106 106
         $user->setPreference(UserInterface::PREF_IS_VISIBLE_ONLINE, (string) $visible_online);
107
-	$user->setPreference(UserInterface::PREF_IS_STATUS_MFA, (string) $status_mfa);
107
+    $user->setPreference(UserInterface::PREF_IS_STATUS_MFA, (string) $status_mfa);
108 108
 
109 109
         if ($tree instanceof Tree) {
110 110
             $default_xref = Validator::parsedBody($request)->string('default-xref');
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
         $language       = Validator::parsedBody($request)->string('language');
68 68
         $real_name      = Validator::parsedBody($request)->string('real_name');
69 69
         $password       = Validator::parsedBody($request)->string('password');
70
-	$secret         = Validator::parsedBody($request)->string('secret');
70
+	$secret = Validator::parsedBody($request)->string('secret');
71 71
         $time_zone      = Validator::parsedBody($request)->string('timezone');
72 72
         $user_name      = Validator::parsedBody($request)->string('user_name');
73 73
         $visible_online = Validator::parsedBody($request)->boolean('visible-online', false);
Please login to merge, or discard this patch.
app/Http/RequestHandlers/SetupWizard.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -409,7 +409,7 @@
 block discarded – undo
409 409
             $admin = $this->user_service->create($data['wtuser'], $data['wtname'], $data['wtemail'], $data['wtpass'], $data['wtsecret']);
410 410
             $admin->setPreference(UserInterface::PREF_LANGUAGE, $data['lang']);
411 411
             $admin->setPreference(UserInterface::PREF_IS_VISIBLE_ONLINE, '1');
412
-	    $admin->setPreference(UserInterface::PREF_IS_STATUS_MFA, '0');
412
+        $admin->setPreference(UserInterface::PREF_IS_STATUS_MFA, '0');
413 413
         } else {
414 414
             $admin->setPassword($_POST['wtpass']);
415 415
         }
Please login to merge, or discard this patch.
app/Http/RequestHandlers/UserAddAction.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
         $real_name = Validator::parsedBody($request)->string('real_name');
60 60
         $email     = Validator::parsedBody($request)->string('email');
61 61
         $password  = Validator::parsedBody($request)->string('password');
62
-	$secret = "";
62
+    $secret = "";
63 63
 
64 64
         $errors = false;
65 65
 
Please login to merge, or discard this patch.
app/Http/RequestHandlers/RegisterAction.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
         $password = Validator::parsedBody($request)->string('password');
97 97
         $realname = Validator::parsedBody($request)->string('realname');
98 98
         $username = Validator::parsedBody($request)->string('username');
99
-	$secret = Validator::parsedBody($request)->string('secret');
99
+    $secret = Validator::parsedBody($request)->string('secret');
100 100
 
101 101
         try {
102 102
             if ($this->captcha_service->isRobot($request)) {
Please login to merge, or discard this patch.
app/Http/RequestHandlers/LoginAction.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $default_url = route(HomePage::class);
70 70
         $username    = Validator::parsedBody($request)->string('username');
71 71
         $password    = Validator::parsedBody($request)->string('password');
72
-	$code2fa    = Validator::parsedBody($request)->string('code2fa');
72
+    $code2fa    = Validator::parsedBody($request)->string('code2fa');
73 73
         $url         = Validator::parsedBody($request)->isLocalUrl()->string('url', $default_url);
74 74
 
75 75
         try {
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
             throw new Exception(I18N::translate('This account has not been approved. Please wait for an administrator to approve it.'));
133 133
         }
134 134
         if ($user->getPreference(UserInterface::PREF_IS_STATUS_MFA) !== '') {
135
-          # covers scenario where 2fa not enabled by user
136
-          if($code2fa != '') {
135
+            # covers scenario where 2fa not enabled by user
136
+            if($code2fa != '') {
137 137
             if (!$user->check2FAcode($code2fa)) {
138 138
                     throw new Exception(I18N::translate('2FA code does not match. Please try again.'));
139 139
             }
140
-          }
141
-          else {
140
+            }
141
+            else {
142 142
                     throw new Exception(I18N::translate('2FA code must be entered as you have 2FA authentication enabled. Please try again.'));
143
-          }
143
+            }
144 144
         }
145 145
         Auth::login($user);
146 146
         Log::addAuthenticationLog('Login: ' . Auth::user()->userName() . '/' . Auth::user()->realName());
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $default_url = route(HomePage::class);
70 70
         $username    = Validator::parsedBody($request)->string('username');
71 71
         $password    = Validator::parsedBody($request)->string('password');
72
-	$code2fa    = Validator::parsedBody($request)->string('code2fa');
72
+	$code2fa = Validator::parsedBody($request)->string('code2fa');
73 73
         $url         = Validator::parsedBody($request)->isLocalUrl()->string('url', $default_url);
74 74
 
75 75
         try {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         }
134 134
         if ($user->getPreference(UserInterface::PREF_IS_STATUS_MFA) !== '') {
135 135
           # covers scenario where 2fa not enabled by user
136
-          if($code2fa != '') {
136
+          if ($code2fa != '') {
137 137
             if (!$user->check2FAcode($code2fa)) {
138 138
                     throw new Exception(I18N::translate('2FA code does not match. Please try again.'));
139 139
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -137,8 +137,7 @@
 block discarded – undo
137 137
             if (!$user->check2FAcode($code2fa)) {
138 138
                     throw new Exception(I18N::translate('2FA code does not match. Please try again.'));
139 139
             }
140
-          }
141
-          else {
140
+          } else {
142 141
                     throw new Exception(I18N::translate('2FA code must be entered as you have 2FA authentication enabled. Please try again.'));
143 142
           }
144 143
         }
Please login to merge, or discard this patch.
app/Http/RequestHandlers/UserEditAction.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $real_name      = Validator::parsedBody($request)->string('real_name');
76 76
         $email          = Validator::parsedBody($request)->string('email');
77 77
         $password       = Validator::parsedBody($request)->string('password');
78
-	$secret         = Validator::parsedBody($request)->string('secret');
78
+    $secret         = Validator::parsedBody($request)->string('secret');
79 79
         $theme          = Validator::parsedBody($request)->string('theme');
80 80
         $language       = Validator::parsedBody($request)->string('language');
81 81
         $timezone       = Validator::parsedBody($request)->string('timezone');
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $canadmin       = Validator::parsedBody($request)->boolean('canadmin', false);
86 86
         $visible_online = Validator::parsedBody($request)->boolean('visible-online', false);
87 87
         $verified       = Validator::parsedBody($request)->boolean('verified', false);
88
-	$status_mfa     = Validator::parsedBody($request)->boolean('status-mfa', false);
88
+    $status_mfa     = Validator::parsedBody($request)->boolean('status-mfa', false);
89 89
         $approved       = Validator::parsedBody($request)->boolean('approved', false);
90 90
 
91 91
         $edit_user = $this->user_service->find($user_id);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $real_name      = Validator::parsedBody($request)->string('real_name');
76 76
         $email          = Validator::parsedBody($request)->string('email');
77 77
         $password       = Validator::parsedBody($request)->string('password');
78
-	$secret         = Validator::parsedBody($request)->string('secret');
78
+	$secret = Validator::parsedBody($request)->string('secret');
79 79
         $theme          = Validator::parsedBody($request)->string('theme');
80 80
         $language       = Validator::parsedBody($request)->string('language');
81 81
         $timezone       = Validator::parsedBody($request)->string('timezone');
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $canadmin       = Validator::parsedBody($request)->boolean('canadmin', false);
86 86
         $visible_online = Validator::parsedBody($request)->boolean('visible-online', false);
87 87
         $verified       = Validator::parsedBody($request)->boolean('verified', false);
88
-	$status_mfa     = Validator::parsedBody($request)->boolean('status-mfa', false);
88
+	$status_mfa = Validator::parsedBody($request)->boolean('status-mfa', false);
89 89
         $approved       = Validator::parsedBody($request)->boolean('approved', false);
90 90
 
91 91
         $edit_user = $this->user_service->find($user_id);
Please login to merge, or discard this patch.
app/User.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -278,24 +278,24 @@
 block discarded – undo
278 278
         return $this;
279 279
     }
280 280
    
281
-      /**
282
-      * Validate a supplied 2fa code
283
-      *
284
-      * @param string $code2fa
285
-      *
286
-      * @return bool
287
-      */
288
-     public function check2facode(string $code2fa): bool
289
-     {
290
-         $secret = DB::table('user')
291
-             ->where('user_id', '=', $this->id())
292
-             ->value('secret');
293
-       $google2fa = new Google2FA;
294
-         if($google2fa->verifyKey($secret, $code2fa)) {
295
-                  return true;
296
-               }
297
-         return false;
298
-     }
281
+        /**
282
+         * Validate a supplied 2fa code
283
+         *
284
+         * @param string $code2fa
285
+         *
286
+         * @return bool
287
+         */
288
+        public function check2facode(string $code2fa): bool
289
+        {
290
+            $secret = DB::table('user')
291
+                ->where('user_id', '=', $this->id())
292
+                ->value('secret');
293
+        $google2fa = new Google2FA;
294
+            if($google2fa->verifyKey($secret, $code2fa)) {
295
+                    return true;
296
+                }
297
+            return false;
298
+        }
299 299
 
300 300
     /**
301 301
      * A closure which will create an object from a database row.
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -291,7 +291,7 @@
 block discarded – undo
291 291
              ->where('user_id', '=', $this->id())
292 292
              ->value('secret');
293 293
        $google2fa = new Google2FA;
294
-         if($google2fa->verifyKey($secret, $code2fa)) {
294
+         if ($google2fa->verifyKey($secret, $code2fa)) {
295 295
                   return true;
296 296
                }
297 297
          return false;
Please login to merge, or discard this patch.
app/Http/RequestHandlers/AccountEdit.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             });
85 85
 
86 86
         $show_delete_option = $user->getPreference(UserInterface::PREF_IS_ADMINISTRATOR) !== '1';
87
-	$show_2fa = Site::getPreference('SHOW_2FA_OPTION') === '1';
87
+    $show_2fa = Site::getPreference('SHOW_2FA_OPTION') === '1';
88 88
         $timezone_ids       = DateTimeZone::listIdentifiers();
89 89
         $timezones          = array_combine($timezone_ids, $timezone_ids);
90 90
         $title              = I18N::translate('My account');
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             'languages'            => $languages->all(),
96 96
             'my_individual_record' => $my_individual_record,
97 97
             'show_delete_option'   => $show_delete_option,
98
-	    'show_2fa'             => $show_2fa,
98
+        'show_2fa'             => $show_2fa,
99 99
             'timezones'            => $timezones,
100 100
             'title'                => $title,
101 101
             'tree'                 => $tree,
Please login to merge, or discard this patch.