Completed
Push — master ( fd273e...919d4e )
by Xu
785:23 queued 745:26
created
src/user/Bootstrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     {
28 28
         //监听用户活动时间
29 29
         /** @var \yii\web\UserEvent $event */
30
-        $app->on(Application::EVENT_AFTER_REQUEST, function ($event) use ($app) {
30
+        $app->on(Application::EVENT_AFTER_REQUEST, function($event) use ($app) {
31 31
             if (!$app->user->isGuest && Yii::$app->has('queue')) {
32 32
                 //$app->user->identity->update
33 33
                 //记录最后活动时间
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
         //监听用户登录事件
39 39
         /** @var \yii\web\UserEvent $event */
40
-        $app->user->on(User::EVENT_AFTER_LOGIN, function ($event) use ($app) {
40
+        $app->user->on(User::EVENT_AFTER_LOGIN, function($event) use ($app) {
41 41
             //记录最后登录时间记录最后登录IP记录登录次数
42 42
             Yii::$app->queue->push(new ResetLoginDataJob(['user_id' => $app->user->identity->getId(), 'ip' => Yii::$app->request->userIP]));
43 43
         });
Please login to merge, or discard this patch.
config/web.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     ],
10 10
     'components' => [
11 11
         'cache' => [
12
-            'keyPrefix' => 'web',       //前缀
12
+            'keyPrefix' => 'web', //前缀
13 13
         ],
14 14
         'user' => [
15 15
             'identityClass' => yuncms\user\models\User::class,
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
             'secureProtocolHeaders' => [
23 23
                 'X-Forwarded-Proto' => ['https'], // Common
24 24
                 'Front-End-Https' => ['on'], // Microsoft
25
-                'X-Client-Scheme' => ['https'],// Aliyun CDN
25
+                'X-Client-Scheme' => ['https'], // Aliyun CDN
26 26
                 'X-Client-Proto' => ['https'],
27 27
             ],
28 28
             'ipHeaders' => [
29
-                'X-Forwarded-For',// Common
29
+                'X-Forwarded-For', // Common
30 30
                 'X-Cluster-Client-IP',
31
-                'ALI-CDN-REAL-IP',// Aliyun CDN
31
+                'ALI-CDN-REAL-IP', // Aliyun CDN
32 32
                 'Client-IP',
33 33
                 'X-Forwarded',
34 34
                 'Forwarded-For',
Please login to merge, or discard this patch.
src/user/controllers/SecurityController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
                 Yii::$app->session->setFlash('danger', Yii::t('yuncms', 'Your account has been blocked.'));
133 133
                 $this->action->successUrl = Url::to(['/user/security/login']);
134 134
             } else {
135
-                Yii::$app->user->login($account->user, Yii::$app->settings->get('rememberFor','user'));
135
+                Yii::$app->user->login($account->user, Yii::$app->settings->get('rememberFor', 'user'));
136 136
                 $this->action->successUrl = Yii::$app->getUser()->getReturnUrl();
137 137
             }
138 138
         } else {
Please login to merge, or discard this patch.
src/user/models/UserProfile.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
     const GENDER_FEMALE = 0b10;
54 54
 
55 55
     //当前状态
56
-    const CURRENT_OTHER = 0b0;//其他
57
-    const CURRENT_WORK = 0b1;//正常工作
58
-    const CURRENT_FREELANCE = 0b10;//自由职业者
59
-    const CURRENT_START = 0b11;//创业
60
-    const CURRENT_OUTSOURCE = 0b100;//外包
61
-    const CURRENT_JOB = 0b101;//求职
62
-    const CURRENT_STUDENT = 0b110;//学生
56
+    const CURRENT_OTHER = 0b0; //其他
57
+    const CURRENT_WORK = 0b1; //正常工作
58
+    const CURRENT_FREELANCE = 0b10; //自由职业者
59
+    const CURRENT_START = 0b11; //创业
60
+    const CURRENT_OUTSOURCE = 0b100; //外包
61
+    const CURRENT_JOB = 0b101; //求职
62
+    const CURRENT_STUDENT = 0b110; //学生
63 63
 
64 64
     /**
65 65
      * @inheritdoc
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             [
102 102
                 'mobile',
103 103
                 MobileValidator::class,
104
-                'when' => function ($model) {
104
+                'when' => function($model) {
105 105
                     return $model->country == 'China';
106 106
                 }
107 107
             ],
Please login to merge, or discard this patch.
src/user/controllers/RegistrationController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
         if ($user->load(Yii::$app->request->post()) && $user->createUser()) {
130 130
             $account->connect($user);
131
-            Yii::$app->user->login($user, Yii::$app->settings->get('rememberFor','user'));
131
+            Yii::$app->user->login($user, Yii::$app->settings->get('rememberFor', 'user'));
132 132
             return $this->goBack();
133 133
         }
134 134
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     public function actionConfirm($id, $code)
150 150
     {
151 151
         $user = User::findOne($id);
152
-        if ($user === null || Yii::$app->settings->get('enableConfirmation','user') == false) {
152
+        if ($user === null || Yii::$app->settings->get('enableConfirmation', 'user') == false) {
153 153
             return $this->goBack();
154 154
         }
155 155
         $user->attemptConfirmation($code);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      */
164 164
     public function actionResend()
165 165
     {
166
-        if (Yii::$app->settings->get('enableConfirmation','user') == false) {
166
+        if (Yii::$app->settings->get('enableConfirmation', 'user') == false) {
167 167
             return $this->goBack();
168 168
         }
169 169
         /** @var ResendForm $model */
Please login to merge, or discard this patch.
src/user/views/security/login.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@
 block discarded – undo
24 24
         'autocomplete' => 'off',
25 25
         'autofocus' => 'autofocus',
26 26
         'tabindex' => '1',
27
-        'placeholder' => Yii::t('yuncms','Please enter your email address / phone number.'),
27
+        'placeholder' => Yii::t('yuncms', 'Please enter your email address / phone number.'),
28 28
         'required' => true,
29 29
     ]]) ?>
30 30
 
31
-    <?= $form->field($model, 'password', ['inputOptions' => ['autocomplete' => 'off','required' => true, 'tabindex' => '2']])->passwordInput()->label(Yii::t('yuncms', 'Password') . (Yii::$app->settings->get('enablePasswordRecovery', 'user') ? ' (' . Html::a(Yii::t('yuncms', 'Forgot password?'), ['/user/recovery/request'], ['tabindex' => '5']) . ')' : '')) ?>
31
+    <?= $form->field($model, 'password', ['inputOptions' => ['autocomplete' => 'off', 'required' => true, 'tabindex' => '2']])->passwordInput()->label(Yii::t('yuncms', 'Password') . (Yii::$app->settings->get('enablePasswordRecovery', 'user') ? ' (' . Html::a(Yii::t('yuncms', 'Forgot password?'), ['/user/recovery/request'], ['tabindex' => '5']) . ')' : '')) ?>
32 32
 
33 33
     <?= $form->field($model, 'rememberMe', [
34 34
         'options' => [
Please login to merge, or discard this patch.
src/user/views/settings/networks.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@
 block discarded – undo
45 45
                                     Html::a(Yii::t('yuncms', 'Disconnect'), $auth->createClientUrl($client), [
46 46
                                         'class' => 'btn btn-danger btn-block',
47 47
                                         'data-method' => 'post',
48
-                                    ]) :
49
-                                    Html::a(Yii::t('yuncms', 'Connect'), $auth->createClientUrl($client), [
48
+                                    ]) : Html::a(Yii::t('yuncms', 'Connect'), $auth->createClientUrl($client), [
50 49
                                         'class' => 'btn btn-success btn-block',
51 50
                                     ])
52 51
                                 ?>
Please login to merge, or discard this patch.
src/user/models/RegistrationForm.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
             'emailUnique' => ['email', 'unique', 'targetClass' => User::class, 'message' => Yii::t('yuncms', 'This email address has already been taken')],
60 60
 
61 61
             // password rules
62
-            'passwordRequired' => ['password', 'required', 'skipOnEmpty' => Yii::$app->settings->get('enableGeneratingPassword','user')],
62
+            'passwordRequired' => ['password', 'required', 'skipOnEmpty' => Yii::$app->settings->get('enableGeneratingPassword', 'user')],
63 63
             'passwordLength' => ['password', 'string', 'min' => 6],
64 64
 
65 65
             // verifyCode needs to be entered correctly
66 66
             'verifyCodeRequired' => ['verifyCode', 'required',
67
-                'skipOnEmpty' => !Yii::$app->settings->get('enableRegistrationCaptcha','user')],
67
+                'skipOnEmpty' => !Yii::$app->settings->get('enableRegistrationCaptcha', 'user')],
68 68
 
69 69
             'verifyCode' => ['verifyCode', 'captcha',
70 70
                 'captchaAction' => '/user/registration/captcha',
71
-                'skipOnEmpty' => !Yii::$app->settings->get('enableRegistrationCaptcha','user')
71
+                'skipOnEmpty' => !Yii::$app->settings->get('enableRegistrationCaptcha', 'user')
72 72
             ],
73 73
 
74 74
             'registrationPolicyRequired' => ['registrationPolicy', 'required', 'skipOnEmpty' => false, 'requiredValue' => true,
75
-                'message' => Yii::t('yuncms', 'By registering you confirm that you accept the Service Agreement and Privacy Policy.'),],
75
+                'message' => Yii::t('yuncms', 'By registering you confirm that you accept the Service Agreement and Privacy Policy.'), ],
76 76
         ];
77 77
     }
78 78
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             return false;
118 118
         }
119 119
         Yii::$app->session->setFlash('info', Yii::t('yuncms', 'Your account has been created and a message with further instructions has been sent to your email'));
120
-        return Yii::$app->getUser()->login($user, Yii::$app->settings->get('rememberFor','user'));
120
+        return Yii::$app->getUser()->login($user, Yii::$app->settings->get('rememberFor', 'user'));
121 121
     }
122 122
 
123 123
     /**
Please login to merge, or discard this patch.
src/user/models/User.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 class User extends \yuncms\models\BaseUser
42 42
 {
43 43
     //场景定义
44
-    const SCENARIO_CREATE = 'create';//后台或控制台创建用户
45
-    const SCENARIO_UPDATE = 'update';//后台或控制台修改用户
46
-    const SCENARIO_REGISTER = 'basic_create';//邮箱注册
47
-    const SCENARIO_EMAIL_REGISTER = 'email_create';//邮箱注册
48
-    const SCENARIO_MOBILE_REGISTER = 'mobile_create';//手机号注册
49
-    const SCENARIO_SETTINGS = 'settings';//更新
50
-    const SCENARIO_CONNECT = 'connect';//账户链接或自动注册新用户
44
+    const SCENARIO_CREATE = 'create'; //后台或控制台创建用户
45
+    const SCENARIO_UPDATE = 'update'; //后台或控制台修改用户
46
+    const SCENARIO_REGISTER = 'basic_create'; //邮箱注册
47
+    const SCENARIO_EMAIL_REGISTER = 'email_create'; //邮箱注册
48
+    const SCENARIO_MOBILE_REGISTER = 'mobile_create'; //手机号注册
49
+    const SCENARIO_SETTINGS = 'settings'; //更新
50
+    const SCENARIO_CONNECT = 'connect'; //账户链接或自动注册新用户
51 51
     const SCENARIO_PASSWORD = 'password';
52 52
 
53 53
     //头像
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     public function behaviors()
71 71
     {
72 72
         $behaviors = parent::behaviors();
73
-        return ArrayHelper::merge($behaviors,[
73
+        return ArrayHelper::merge($behaviors, [
74 74
             'taggable' => [
75 75
                 'class' => TaggableBehavior::class,
76 76
                 'tagValuesAsArray' => true,
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
             static::SCENARIO_EMAIL_REGISTER => ['nickname', 'email', 'password'],
94 94
             static::SCENARIO_MOBILE_REGISTER => ['mobile', 'password'],
95 95
             static::SCENARIO_SETTINGS => ['username', 'email', 'password'],
96
-            static::SCENARIO_CONNECT => ['nickname', 'email', 'password'],//链接账户密码可以为空邮箱可以为空
97
-            static::SCENARIO_PASSWORD => ['password'],//只修改密码
96
+            static::SCENARIO_CONNECT => ['nickname', 'email', 'password'], //链接账户密码可以为空邮箱可以为空
97
+            static::SCENARIO_PASSWORD => ['password'], //只修改密码
98 98
         ]);
99 99
     }
100 100
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function rules()
106 106
     {
107
-        return ArrayHelper::merge(parent::rules(),[
107
+        return ArrayHelper::merge(parent::rules(), [
108 108
             // nickname rules
109 109
             'nicknameRequired' => ['nickname', 'required', 'on' => [self::SCENARIO_EMAIL_REGISTER, self::SCENARIO_CONNECT]],
110 110
             // email rules
Please login to merge, or discard this patch.