Completed
Push — master ( d31399...3bd1f0 )
by Charles
01:42
created
actions/OTPAction.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use app\models\User;
6 6
 use yrc\rest\Action as RestAction;
7
-
8 7
 use yii\web\HttpException;
9 8
 use Yii;
10 9
 
Please login to merge, or discard this patch.
actions/RefreshAction.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use yrc\api\actions\AuthenticationAction;
6 6
 use app\models\Token;
7
-use yrc\models\TokenKeyPair;
8
-use yrc\web\Json25519Parser;
9 7
 use yrc\rest\Action as RestAction;
10 8
 use yii\helpers\ArrayHelper;
11 9
 use Yii;
Please login to merge, or discard this patch.
actions/RegisterAction.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 {
17 17
     /**
18 18
      * Handles registration of users
19
-     * @return mixed
19
+     * @return boolean
20 20
      */
21 21
     public function post($params)
22 22
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use app\forms\Registration;
6 6
 use yrc\rest\Action as RestAction;
7
-
8 7
 use yii\web\HttpException;
9 8
 use Yii;
10 9
 
Please login to merge, or discard this patch.
actions/ResetPasswordAction.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use app\forms\ResetPassword;
6 6
 use yrc\rest\Action as RestAction;
7
-use yrc\models\Code;
8
-
9 7
 use yii\web\HttpException;
10 8
 use Yii;
11 9
 
Please login to merge, or discard this patch.
forms/ChangeEmail.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace yrc\forms;
4 4
 
5
-use Base32\Base32;
6 5
 use Yii;
7 6
 
8 7
 /**
Please login to merge, or discard this patch.
forms/Login.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace yrc\forms;
4 4
 
5 5
 use app\models\Token;
6
-use yii\web\UnauthorizedHttpException;
7 6
 use Yii;
8 7
 
9 8
 /**
Please login to merge, or discard this patch.
forms/ResetPassword.php 1 patch
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -94,6 +94,8 @@
 block discarded – undo
94 94
     /**
95 95
      * Validates the users OTP code, if they provided
96 96
      * @inheritdoc
97
+     * @param string $attributes
98
+     * @param string $params
97 99
      */
98 100
     public function validateOTP($attributes, $params)
99 101
     {
Please login to merge, or discard this patch.
models/redis/Token.php 3 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     }
46 46
 
47 47
     /**
48
-     * @return sodium_crypto_sign_publickey
48
+     * @return string
49 49
      */
50 50
     public function getSignPublicKey()
51 51
     {
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
     /**
56 56
      * Generates a new auth and refresh token pair
57 57
      * @param int $userId
58
-     * @param bool $pubkey
59
-     * @return array
58
+     * @return Token
60 59
      */
61 60
     public static function generate($userId = null)
62 61
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
         $token->user_id = $userId;
73 73
         $token->access_token = \str_replace('=', '', Base32::encode(\random_bytes(32)));
74 74
         $token->refresh_token = \str_replace('=', '', Base32::encode(\random_bytes(32)));
75
-        $token->ikm =  \base64_encode(\random_bytes(32));
75
+        $token->ikm = \base64_encode(\random_bytes(32));
76 76
         $token->secret_sign_kp = \base64_encode(sodium_crypto_sign_secretkey($signKp));
77 77
         $token->expires_at = \strtotime(static::TOKEN_EXPIRATION_TIME);
78 78
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace yrc\models\redis;
4 4
 
5 5
 use Base32\Base32;
6
-use yrc\models\TokenKeyPair;
7 6
 use Yii;
8 7
 
9 8
 /**
Please login to merge, or discard this patch.
models/User.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Base32\Base32;
6 6
 use OTPHP\TOTP;
7
-
8 7
 use yii\behaviors\TimestampBehavior;
9 8
 use yii\db\ActiveRecord;
10 9
 use yii\filters\RateLimitInterface;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
         $encodedSecret = Base32::encode($secret);
274 274
         $totp = TOTP::create(
275 275
             $encodedSecret,
276
-            30,             // 30 second window
277
-            'sha256',       // SHA256 for the hashing algorithm
276
+            30, // 30 second window
277
+            'sha256', // SHA256 for the hashing algorithm
278 278
             6               // 6 digits
279 279
         );
280 280
         $totp->setLabel($this->username);
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
     {
329 329
         $totp = TOTP::create(
330 330
             $this->otp_secret,
331
-            30,             // 30 second window
332
-            'sha256',       // SHA256 for the hashing algorithm
331
+            30, // 30 second window
332
+            'sha256', // SHA256 for the hashing algorithm
333 333
             6               // 6 digits
334 334
         );
335 335
 
Please login to merge, or discard this patch.