public function testValidateEmail() { $form = \Yii::createObject(ResendForm::className()); $user = $this->getFixture('user')->getModel('user'); $form->setAttributes(['email' => $user->email]); $this->assertFalse($form->validate()); $form = \Yii::createObject(ResendForm::className()); $user = $this->getFixture('user')->getModel('unconfirmed'); $form->setAttributes(['email' => $user->email]); $this->assertTrue($form->validate()); }
/** * 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(); } $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]); }