public function testValidateEmail() { $form = new ResendForm(); $user = $this->getFixture('user')->getModel('user'); $form->setAttributes(['email' => $user->email]); $this->assertFalse($form->validate()); $form = new ResendForm(); $user = $this->getFixture('user')->getModel('unconfirmed'); $form->setAttributes(['email' => $user->email]); $this->assertTrue($form->validate()); }
public function actionResend() { //$this->layout = 'login'; if ($this->module->enableConfirmation == false) { throw new NotFoundHttpException(); } /** @var ResendForm $model */ $model = Yii::createObject(ResendForm::className()); $this->performAjaxValidation($model); if ($model->load(Yii::$app->request->post()) && $model->resend()) { return $this->render('/message', ['title' => Yii::t('user', 'A new confirmation link has been sent'), 'module' => $this->module]); } return $this->render('resend', ['model' => $model]); }
/** * Displays page where user can request new confirmation token. If resending was successful, displays message. * * @return string * @throws \yii\web\HttpException */ public function actionResend() { if ($this->module->enableConfirmation == false) { throw new NotFoundHttpException(); } /** @var ResendForm $model */ $model = Yii::createObject(ResendForm::className()); $event = $this->getFormEvent($model); $this->trigger(self::EVENT_BEFORE_RESEND, $event); $this->performAjaxValidation($model); if ($model->load(Yii::$app->request->post()) && $model->resend()) { $this->trigger(self::EVENT_AFTER_RESEND, $event); return $this->render('/loginEmail', ['title' => Yii::t('user', 'A new confirmation link has been sent'), 'module' => $this->module, "email" => $model->email, "emailFacilitator" => Util::getEmailLoginUrl($model->email)]); } return $this->render('resend', ['model' => $model]); }