/** * @inheritdoc */ public function rules() { $captcha = []; if (Core::isReCaptchaEnabled()) { $captcha = [['verifyCode', 'required', 'message' => Yii::t('app', 'Prove you are NOT a robot')], ['verifyCode', ReCaptchaValidator::className(), 'message' => Yii::t('app', 'Prove you are NOT a robot')]]; } $default = [[['newEmail'], 'required'], ['newEmail', 'email'], ['newEmail', 'filter', 'filter' => 'trim'], ['newEmail', 'filter', 'filter' => 'strtolower'], ['newEmail', 'unique', 'targetAttribute' => 'email', 'targetClass' => 'common\\models\\Account', 'message' => Yii::t('app', 'This email address has already been taken.')]]; return array_merge($default, $captcha); }
/** * @inheritdoc */ public function rules() { $captcha = []; if (Core::isReCaptchaEnabled()) { $captcha = [['verifyCode', 'required', 'message' => Yii::t('app', 'Prove you are NOT a robot')], ['verifyCode', ReCaptchaValidator::className(), 'message' => Yii::t('app', 'Prove you are NOT a robot')]]; } $default = [['email', 'filter', 'filter' => 'trim'], ['email', 'filter', 'filter' => 'strtolower'], ['email', 'required'], ['email', 'email'], ['email', 'exist', 'targetClass' => 'common\\models\\Account', 'filter' => ['status' => Account::STATUS_ACTIVE], 'message' => Yii::t('app', 'There is no user with such email.')]]; return array_merge($default, $captcha); }
<div class="account-reset"> <div class="row"> <div style="" class="col-xs-12"> <h1 class="no-margin"><?php echo $this->title; ?> </h1> <div><hr /></div> <?php $form = ActiveForm::begin(['id' => 'request-password-reset-form']); ?> <?php echo $form->field($model, 'email'); ?> <?php if (Core::isReCaptchaEnabled()) { ?> <?php echo $form->field($model, 'verifyCode')->widget(ReCaptcha::className())->label(false); ?> <?php } ?> <div class="form-group"> <?php echo Html::submitButton(Yii::t('app', 'Reset Password'), ['class' => 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
echo Html::encode($this->title); ?> </h1> <div class="row"> <div class="col-xs-12"> <?php $form = ActiveForm::begin(['id' => 'signup-form', 'enableAjaxValidation' => false]); ?> <?php echo $form->field($model, 'name'); ?> <?php echo $form->field($model, 'email'); ?> <?php if (\common\Core::isReCaptchaEnabled()) { ?> <?php echo $form->field($model, 'captcha')->widget(ReCaptcha::className())->label(false); ?> <?php } ?> <p> <?php echo Yii::t('app', 'By clicking on the "Signup" button below, you certify that you have read and agree to our {TERMS} and {PRIVACY}.', ['TERMS' => Html::a('terms of use', Yii::$app->urlManager->createUrl(['/site/page', 'id' => 'terms']), ['target' => '_blank']), 'PRIVACY' => Html::a('privacy policy', Yii::$app->urlManager->createUrl(['/site/page', 'id' => 'privacy']), ['target' => '_blank'])]); ?> </p>