@@ -24,11 +24,11 @@ |
||
| 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' => [ |
@@ -45,8 +45,7 @@ |
||
| 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 | ?> |
@@ -59,20 +59,20 @@ discard block |
||
| 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 |
||
| 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 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'emailRequired' => ['email', 'required'], |
| 50 | 50 | 'emailPattern' => ['email', 'email'], |
| 51 | 51 | 'emailExist' => ['email', 'exist', 'targetClass' => User::class], |
| 52 | - 'emailConfirmed' => ['email', function () { |
|
| 52 | + 'emailConfirmed' => ['email', function() { |
|
| 53 | 53 | if ($this->user != null && $this->user->isEmailConfirmed) { |
| 54 | 54 | $this->addError('email', Yii::t('yuncms', 'This account has already been confirmed')); |
| 55 | 55 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** @var UserToken $token */ |
| 89 | 89 | $token = new UserToken(['user_id' => $this->user->id, 'type' => UserToken::TYPE_CONFIRMATION]); |
| 90 | 90 | $token->save(false); |
| 91 | - $this->sendMessage($this->user->email,Yii::t('yuncms', 'Confirm account on {0}', Yii::$app->name),'confirmation',['user' => $this->user, 'token' => $token]); |
|
| 91 | + $this->sendMessage($this->user->email, Yii::t('yuncms', 'Confirm account on {0}', Yii::$app->name), 'confirmation', ['user' => $this->user, 'token' => $token]); |
|
| 92 | 92 | Yii::$app->session->setFlash('info', Yii::t('yuncms', 'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.')); |
| 93 | 93 | return true; |
| 94 | 94 | } |
@@ -41,13 +41,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
@@ -91,12 +91,12 @@ |
||
| 91 | 91 | 'emailRequired' => ['email', 'required'], |
| 92 | 92 | 'emailTrim' => ['email', 'filter', 'filter' => 'trim'], |
| 93 | 93 | 'emailPattern' => ['email', 'email'], |
| 94 | - 'emailUsernameUnique' => [['email', 'username'], 'unique', 'when' => function ($model, $attribute) { |
|
| 94 | + 'emailUsernameUnique' => [['email', 'username'], 'unique', 'when' => function($model, $attribute) { |
|
| 95 | 95 | return $this->user->$attribute != $model->$attribute; |
| 96 | 96 | }, 'targetClass' => User::class], |
| 97 | 97 | 'newPasswordLength' => ['new_password', 'string', 'min' => 6], |
| 98 | 98 | 'currentPasswordRequired' => ['current_password', 'required'], |
| 99 | - 'currentPasswordValidate' => ['current_password', function ($attr) { |
|
| 99 | + 'currentPasswordValidate' => ['current_password', function($attr) { |
|
| 100 | 100 | if (!PasswordHelper::validate($this->$attr, $this->user->password_hash)) { |
| 101 | 101 | $this->addError($attr, Yii::t('yuncms', 'Current password is not valid')); |
| 102 | 102 | } |
@@ -15,9 +15,12 @@ |
||
| 15 | 15 | </a> |
| 16 | 16 | </li> |
| 17 | 17 | <?php endforeach; ?> |
| 18 | - <?php else: ?> |
|
| 18 | + <?php else { |
|
| 19 | + : ?> |
|
| 19 | 20 | <?= Yii::t('yuncms', 'No popular users') ?> |
| 20 | - <?php endif; ?> |
|
| 21 | + <?php endif; |
|
| 22 | +} |
|
| 23 | +?> |
|
| 21 | 24 | </ul> |
| 22 | 25 | </div> |
| 23 | 26 | </div> |
@@ -40,7 +40,6 @@ |
||
| 40 | 40 | * @property-read boolean $isBlocked 账户是否锁定 |
| 41 | 41 | * @property-read bool $isMobileConfirmed 是否已经手机激活 |
| 42 | 42 | * @property-read bool $isEmailConfirmed 是否已经邮箱激活 |
| 43 | - |
|
| 44 | 43 | * |
| 45 | 44 | */ |
| 46 | 45 | class BaseUser extends ActiveRecord implements IdentityInterface, RateLimitInterface, NotifiableInterface |