@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'rules' => [ |
| 54 | 54 | [ |
| 55 | 55 | 'allow' => true, |
| 56 | - 'actions' => ['profile', 'account', 'privacy', 'avatar', 'confirm', 'networks', 'disconnect','follower-tag'], |
|
| 56 | + 'actions' => ['profile', 'account', 'privacy', 'avatar', 'confirm', 'networks', 'disconnect', 'follower-tag'], |
|
| 57 | 57 | 'roles' => ['@'], |
| 58 | 58 | ], |
| 59 | 59 | ], |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | Yii::$app->response->format = Response::FORMAT_JSON; |
| 129 | 129 | $tagId = Yii::$app->request->post('tag_id', null); |
| 130 | 130 | if (($tag = Tag::findOne($tagId)) == null) { |
| 131 | - throw new NotFoundHttpException (); |
|
| 131 | + throw new NotFoundHttpException(); |
|
| 132 | 132 | } else { |
| 133 | 133 | /** @var \yuncms\user\models\User $user */ |
| 134 | 134 | $user = Yii::$app->user->identity; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | 'loginTrim' => ['login', 'trim'], |
| 63 | 63 | 'passwordValidate' => [ |
| 64 | 64 | 'password', |
| 65 | - function ($attribute) { |
|
| 65 | + function($attribute) { |
|
| 66 | 66 | if ($this->user === null || !PasswordHelper::validate($this->password, $this->user->password_hash)) { |
| 67 | 67 | $this->addError($attribute, Yii::t('user', 'Invalid login or password')); |
| 68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ], |
| 71 | 71 | 'confirmationValidate' => [ |
| 72 | 72 | 'login', |
| 73 | - function ($attribute) { |
|
| 73 | + function($attribute) { |
|
| 74 | 74 | if ($this->user !== null) { |
| 75 | 75 | $confirmationRequired = $this->getSetting('enableConfirmation') && !$this->getSetting('enableUnconfirmedLogin'); |
| 76 | 76 | if ($confirmationRequired && !$this->user->isEmailConfirmed) { |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | ], |
| 77 | 77 | |
| 78 | 78 | 'registrationPolicyRequired' => ['registrationPolicy', 'required', 'skipOnEmpty' => false, 'requiredValue' => true, |
| 79 | - 'message' => Yii::t('user', 'By registering you confirm that you accept the Service Agreement and Privacy Policy.'),], |
|
| 79 | + 'message' => Yii::t('user', 'By registering you confirm that you accept the Service Agreement and Privacy Policy.'), ], |
|
| 80 | 80 | ]; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | 'emailRequired' => ['email', 'required'], |
| 66 | 66 | 'emailPattern' => ['email', 'email'], |
| 67 | 67 | 'emailExist' => ['email', 'exist', 'targetClass' => User::className(), 'message' => Yii::t('user', 'There is no user with this email address')], |
| 68 | - 'emailUnconfirmed' => ['email', function ($attribute) { |
|
| 68 | + 'emailUnconfirmed' => ['email', function($attribute) { |
|
| 69 | 69 | $this->user = User::findByEmail($this->email); |
| 70 | 70 | if ($this->user !== null && $this->getSetting('enableConfirmation') && !$this->user->isEmailConfirmed) { |
| 71 | 71 | $this->addError($attribute, Yii::t('user', 'You need to confirm your email address.')); |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | if ($this->validate()) { |
| 87 | 87 | /** @var UserToken $token */ |
| 88 | - $token = new UserToken([ 'user_id' => $this->user->id, 'type' => UserToken::TYPE_RECOVERY]); |
|
| 88 | + $token = new UserToken(['user_id' => $this->user->id, 'type' => UserToken::TYPE_RECOVERY]); |
|
| 89 | 89 | $token->save(false); |
| 90 | - $this->sendMessage($this->user->email,Yii::t('user', 'Complete password reset on {0}', Yii::$app->name),'recovery',['user' => $this->user, 'token' => $token]); |
|
| 90 | + $this->sendMessage($this->user->email, Yii::t('user', 'Complete password reset on {0}', Yii::$app->name), 'recovery', ['user' => $this->user, 'token' => $token]); |
|
| 91 | 91 | Yii::$app->session->setFlash('info', Yii::t('user', 'An email has been sent with instructions for resetting your password')); |
| 92 | 92 | return true; |
| 93 | 93 | } |
@@ -94,12 +94,12 @@ |
||
| 94 | 94 | 'emailRequired' => ['email', 'required'], |
| 95 | 95 | 'emailTrim' => ['email', 'filter', 'filter' => 'trim'], |
| 96 | 96 | 'emailPattern' => ['email', 'email'], |
| 97 | - 'emailUsernameUnique' => [['email', 'username'], 'unique', 'when' => function ($model, $attribute) { |
|
| 97 | + 'emailUsernameUnique' => [['email', 'username'], 'unique', 'when' => function($model, $attribute) { |
|
| 98 | 98 | return $this->user->$attribute != $model->$attribute; |
| 99 | 99 | }, 'targetClass' => User::class], |
| 100 | 100 | 'newPasswordLength' => ['new_password', 'string', 'min' => 6], |
| 101 | 101 | 'currentPasswordRequired' => ['current_password', 'required'], |
| 102 | - 'currentPasswordValidate' => ['current_password', function ($attr) { |
|
| 102 | + 'currentPasswordValidate' => ['current_password', function($attr) { |
|
| 103 | 103 | if (!PasswordHelper::validate($this->$attr, $this->user->password_hash)) { |
| 104 | 104 | $this->addError($attr, Yii::t('user', 'Current password is not valid')); |
| 105 | 105 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | 'emailRequired' => ['email', 'required'], |
| 52 | 52 | 'emailPattern' => ['email', 'email'], |
| 53 | 53 | 'emailExist' => ['email', 'exist', 'targetClass' => User::class], |
| 54 | - 'emailConfirmed' => ['email', function () { |
|
| 54 | + 'emailConfirmed' => ['email', function() { |
|
| 55 | 55 | if ($this->user != null && $this->user->isEmailConfirmed) { |
| 56 | 56 | $this->addError('email', Yii::t('user', 'This account has already been confirmed')); |
| 57 | 57 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | /** @var UserToken $token */ |
| 91 | 91 | $token = new UserToken(['user_id' => $this->user->id, 'type' => UserToken::TYPE_CONFIRMATION]); |
| 92 | 92 | $token->save(false); |
| 93 | - $this->sendMessage($this->user->email,Yii::t('user', 'Confirm account on {0}', Yii::$app->name),'confirmation',['user' => $this->user, 'token' => $token]); |
|
| 93 | + $this->sendMessage($this->user->email, Yii::t('user', 'Confirm account on {0}', Yii::$app->name), 'confirmation', ['user' => $this->user, 'token' => $token]); |
|
| 94 | 94 | Yii::$app->session->setFlash('info', Yii::t('user', 'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.')); |
| 95 | 95 | return true; |
| 96 | 96 | } |