public function getEmailConfirmToken() { return $this->hasOne(UserEmailConfirmToken::className(), ['user_id' => 'id']); }
public function actionConfirmEmail($token) { $tokenModel = UserEmailConfirmToken::findToken($token); if ($tokenModel) { Yii::$app->getSession()->setFlash('success', $tokenModel->confirm($token)); } else { Yii::$app->getSession()->setFlash('error', Yii::t('users', 'CONFIRMATION_LINK_IS_WRONG')); } return $this->redirect(Url::toRoute('/login')); }