Failed Conditions
Pull Request — oauthcreation (#531)
by Simon
06:20
created
includes/DataObjects/Credential.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     }
113 113
 
114 114
     /**
115
-     * @return mixed
115
+     * @return null|DateTimeImmutable
116 116
      */
117 117
     public function getTimeout()
118 118
     {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     }
125 125
 
126 126
     /**
127
-     * @param mixed $timeout
127
+     * @param null|DateTimeImmutable $timeout
128 128
      */
129 129
     public function setTimeout(DateTimeImmutable $timeout = null)
130 130
     {
Please login to merge, or discard this patch.
includes/Pages/UserAuth/Login/LoginCredentialPageBase.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -281,6 +281,9 @@  discard block
 block discarded – undo
281 281
         $this->redirect("login/" . $this->nextPageMap[$nextStage]);
282 282
     }
283 283
 
284
+    /**
285
+     * @param integer|null $partialStage
286
+     */
284 287
     private function setupAlternates(User $user, $partialStage, PdoDatabase $database)
285 288
     {
286 289
         // get the providers available
@@ -313,7 +316,7 @@  discard block
 block discarded – undo
313 316
 
314 317
     /**
315 318
      * @param $types
316
-     * @param $type
319
+     * @param string $type
317 320
      * @param $userOptions
318 321
      *
319 322
      * @return mixed
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             }
135 135
             else {
136 136
                 // This is the login form, not the request form. We need protection here.
137
-                $this->redirectUrl('https://' . WebRequest::serverName() . WebRequest::requestUri());
137
+                $this->redirectUrl('https://'.WebRequest::serverName().WebRequest::requestUri());
138 138
 
139 139
                 return false;
140 140
             }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             throw new ApplicationLogicException('Unknown page handler for next authentication stage.');
279 279
         }
280 280
 
281
-        $this->redirect("login/" . $this->nextPageMap[$nextStage]);
281
+        $this->redirect("login/".$this->nextPageMap[$nextStage]);
282 282
     }
283 283
 
284 284
     private function setupAlternates(User $user, $partialStage, PdoDatabase $database)
Please login to merge, or discard this patch.
includes/Security/CredentialProviders/ICredentialProvider.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -31,6 +31,7 @@
 block discarded – undo
31 31
 
32 32
     /**
33 33
      * @param User $user
34
+     * @return void
34 35
      */
35 36
     public function deleteCredential(User $user);
36 37
 
Please login to merge, or discard this patch.
includes/Security/CredentialProviders/TotpCredentialProvider.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -61,6 +61,9 @@
 block discarded – undo
61 61
         return $totp->verify($data, null, 2);
62 62
     }
63 63
 
64
+    /**
65
+     * @param null|string $data
66
+     */
64 67
     public function verifyEnable(User $user, $data)
65 68
     {
66 69
         $storedData = $this->getCredentialData($user->getId(), true);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
      */
92 92
     public function setCredential(User $user, $factor, $data)
93 93
     {
94
-        $issuer = 'ACC - ' . $this->getConfiguration()->getIrcNotificationsInstance();
94
+        $issuer = 'ACC - '.$this->getConfiguration()->getIrcNotificationsInstance();
95 95
         $totp = new TOTP($user->getUsername());
96 96
         $totp->setIssuer($issuer);
97 97
 
Please login to merge, or discard this patch.
includes/Security/CredentialProviders/YubikeyOtpCredentialProvider.php 2 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     }
105 105
 
106 106
     /**
107
-     * @param $result
107
+     * @param string $result
108 108
      *
109 109
      * @return array
110 110
      */
@@ -123,6 +123,9 @@  discard block
 block discarded – undo
123 123
         return $data;
124 124
     }
125 125
 
126
+    /**
127
+     * @param string $data
128
+     */
126 129
     private function getYubikeyId($data)
127 130
     {
128 131
         return substr($data, 0, -32);
@@ -146,7 +149,7 @@  discard block
 block discarded – undo
146 149
     }
147 150
 
148 151
     /**
149
-     * @param $data
152
+     * @param string $data
150 153
      *
151 154
      * @return bool
152 155
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
 
137 137
         $data = array();
138 138
         foreach ($apiResponse as $key => $value) {
139
-            $data[] = $key . "=" . $value;
139
+            $data[] = $key."=".$value;
140 140
         }
141 141
         $dataString = implode('&', $data);
142 142
 
Please login to merge, or discard this patch.
includes/WebRequest.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -513,6 +513,10 @@
 block discarded – undo
513 513
         return isset($session['oauthPartialLogin']) ? (int)$session['oauthPartialLogin'] : null;
514 514
     }
515 515
 
516
+    /**
517
+     * @param integer $userId
518
+     * @param integer $stage
519
+     */
516 520
     public static function setAuthPartialLogin($userId, $stage)
517 521
     {
518 522
         $session = &self::$globalStateProvider->getSessionSuperGlobal();
Please login to merge, or discard this patch.
config.inc.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 $BUbasefile = "backup"; // The basefile's name.
132 132
 $BUdir = "/home/project/a/c/c/acc/backups"; // The directory where backups should be stored.
133
-$BUmonthdir = $BUdir . "/monthly"; // The directory where monthly backups should be stored.
133
+$BUmonthdir = $BUdir."/monthly"; // The directory where monthly backups should be stored.
134 134
 $BUdumper = "/opt/ts/mysql/5.1/bin/mysqldump --defaults-file=~/.my.cnf p_acc_live"; // Add parameters here if they are needed.
135 135
 $BUgzip = "/usr/bin/gzip"; // Add the gzip parameters here if needed.
136 136
 $BUtar = "/bin/tar -cvf"; // Add the tar parameters here if needed.
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 $curlDisableSSLVerifyPeer = false;
247 247
 
248 248
 // Change this to be outside the web directory.
249
-$curlCookieJar = __DIR__ . '/../cookies.txt';
249
+$curlCookieJar = __DIR__.'/../cookies.txt';
250 250
 
251 251
 $yubicoApiId = 0;
252 252
 $yubicoApiKey = "";
@@ -265,17 +265,17 @@  discard block
 block discarded – undo
265 265
 
266 266
 $cDatabaseConfig = array(
267 267
     "acc"           => array(
268
-        "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database,
268
+        "dsrcname" => "mysql:host=".$toolserver_host.";dbname=".$toolserver_database,
269 269
         "username" => $toolserver_username,
270 270
         "password" => $toolserver_password,
271 271
     ),
272 272
     "wikipedia"     => array(
273
-        "dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db,
273
+        "dsrcname" => "mysql:host=".$antispoof_host.";dbname=".$antispoof_db,
274 274
         "username" => $toolserver_username,
275 275
         "password" => $toolserver_password,
276 276
     ),
277 277
     "notifications" => array(
278
-        "dsrcname" => "mysql:host=" . $toolserver_notification_dbhost . ";dbname=" . $toolserver_notification_database,
278
+        "dsrcname" => "mysql:host=".$toolserver_notification_dbhost.";dbname=".$toolserver_notification_database,
279 279
         "username" => $notifications_username,
280 280
         "password" => $notifications_password,
281 281
     ),
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
 }
306 306
 
307 307
 // Set up the AutoLoader
308
-require_once(__DIR__ . "/includes/AutoLoader.php");
308
+require_once(__DIR__."/includes/AutoLoader.php");
309 309
 spl_autoload_register('Waca\\AutoLoader::load');
310
-require_once(__DIR__ . '/vendor/autoload.php');
310
+require_once(__DIR__.'/vendor/autoload.php');
311 311
 
312 312
 // Extra includes which are just plain awkward wherever they are.
313
-require_once(__DIR__ . '/lib/mediawiki-extensions-OAuth/lib/OAuth.php');
314
-require_once(__DIR__ . '/lib/mediawiki-extensions-OAuth/lib/JWT.php');
313
+require_once(__DIR__.'/lib/mediawiki-extensions-OAuth/lib/OAuth.php');
314
+require_once(__DIR__.'/lib/mediawiki-extensions-OAuth/lib/JWT.php');
315 315
 
316 316
 // Crap that's needed for libraries. >:(
317 317
 /**
Please login to merge, or discard this patch.
includes/Pages/UserAuth/MultiFactor/PageMultiFactor.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                     SessionAlert::success('Enabled YubiKey OTP.');
79 79
 
80 80
                     $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration());
81
-                    if($scratchProvider->getRemaining($currentUser->getId()) < 3) {
81
+                    if ($scratchProvider->getRemaining($currentUser->getId()) < 3) {
82 82
                         $scratchProvider->setCredential($currentUser, 2, null);
83 83
                         $tokens = $scratchProvider->getTokens($currentUser->getId());
84 84
                         $this->assign('tokens', $tokens);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                     }
88 88
                 }
89 89
                 catch (ApplicationLogicException $ex) {
90
-                    SessionAlert::error('Error enabling YubiKey OTP: ' . $ex->getMessage());
90
+                    SessionAlert::error('Error enabling YubiKey OTP: '.$ex->getMessage());
91 91
                 }
92 92
 
93 93
                 $this->redirect('multiFactor');
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                         SessionAlert::success('Enabled TOTP.');
179 179
 
180 180
                         $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration());
181
-                        if($scratchProvider->getRemaining($currentUser->getId()) < 3) {
181
+                        if ($scratchProvider->getRemaining($currentUser->getId()) < 3) {
182 182
                             $scratchProvider->setCredential($currentUser, 2, null);
183 183
                             $tokens = $scratchProvider->getTokens($currentUser->getId());
184 184
                             $this->assign('tokens', $tokens);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
                     list($data, $reqs) = $otpCredentialProvider->getRegistrationData();
256 256
 
257
-                    $u2fRequest =json_encode($data);
257
+                    $u2fRequest = json_encode($data);
258 258
                     $u2fSigns = json_encode($reqs);
259 259
 
260 260
                     $this->addJs('/vendor/yubico/u2flib-server/examples/assets/u2f-api.js');
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                     SessionAlert::success('Enabled TOTP.');
304 304
 
305 305
                     $scratchProvider = new ScratchTokenCredentialProvider($database, $this->getSiteConfiguration());
306
-                    if($scratchProvider->getRemaining($currentUser->getId()) < 3) {
306
+                    if ($scratchProvider->getRemaining($currentUser->getId()) < 3) {
307 307
                         $scratchProvider->setCredential($currentUser, 2, null);
308 308
                         $tokens = $scratchProvider->getTokens($currentUser->getId());
309 309
                         $this->assign('tokens', $tokens);
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 
408 408
             if ($result) {
409 409
                 $otpCredentialProvider->deleteCredential($currentUser);
410
-                SessionAlert::success('Disabled ' . $factorType . '.');
410
+                SessionAlert::success('Disabled '.$factorType.'.');
411 411
                 $this->redirect('multiFactor');
412 412
             }
413 413
             else {
414
-                SessionAlert::error('Error disabling ' . $factorType . ' - invalid credentials.');
414
+                SessionAlert::error('Error disabling '.$factorType.' - invalid credentials.');
415 415
                 $this->redirect('multiFactor');
416 416
             }
417 417
         }
Please login to merge, or discard this patch.
includes/Pages/UserAuth/Login/PagePasswordLogin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
     {
18 18
         list($partialId, $partialStage) = WebRequest::getAuthPartialLogin();
19 19
 
20
-        if($partialId !== null && $partialStage > 1) {
20
+        if ($partialId !== null && $partialStage > 1) {
21 21
             $sql = 'SELECT type FROM credential WHERE user = :user AND factor = :stage AND disabled = 0 ORDER BY priority';
22 22
             $statement = $this->getDatabase()->prepare($sql);
23 23
             $statement->execute(array(':user' => $partialId, ':stage' => $partialStage));
24 24
             $nextStage = $statement->fetchColumn();
25 25
             $statement->closeCursor();
26 26
 
27
-            $this->redirect("login/" . $this->nextPageMap[$nextStage]);
27
+            $this->redirect("login/".$this->nextPageMap[$nextStage]);
28 28
             return;
29 29
         }
30 30
 
Please login to merge, or discard this patch.