controllers/DefaultController.php
public function actionConfirm($auth_key)
    {
        $model = $this->findModel(true);
        /**
         * @var User $user
         */
        if ($auth_key && ($user = $model::findOne(compact('auth_key')))) {
            Yii::$app->session->setFlash("success", Yii::t('modules/user',
                "You have successfully completed your registration. Please set your password."));
            Yii::$app->user->login($user);
            $user->activate();
        }else{
            Yii::$app->session->setFlash("error", Yii::t('modules/user', "Your auth link is invalid."));
            return $this->goHome();
        }
        $this->redirect(['update']);
    }
public function actionConfirm($auth_key)
    {
        $model = $this->findModel(true);
        /**
         * @var User $user
         */
        if ($auth_key && ($user = $model::findOne(compact('auth_key')))) {
            Yii::$app->session->setFlash("success", Yii::t('modules/user',
                "You have successfully completed your registration. Please set your password."));
            Yii::$app->user->login($user);
            $user->activate();
        }else{
            Yii::$app->session->setFlash("error", Yii::t('modules/user', "Your auth link is invalid."));
            return $this->goHome();
        }
        $this->redirect(['update']);
    }
public function actionConfirm ( $ auth_key ) { $ model = $ this -> findModel ( true ) ; /**
         * @var User $user
         */ if ( $ auth_key && ( $ user = $ model :: findOne ( compact ( 'auth_key' ) ) ) ) { Yii :: $ app -> session -> setFlash ( "success" , Yii :: t ( 'modules/user' , "You have successfully completed your registration. Please set your password." ) ) ; Yii :: $ app -> user -> login ( $ user ) ; $ user -> activate ( ) ; } else { Yii :: $ app -> session -> setFlash ( "error" , Yii :: t ( 'modules/user' , "Your auth link is invalid." ) ) ; return $ this -> goHome ( ) ; } $ this -> redirect ( [ 'update' ] ) ; }
For registration confirmation by email auth link.
@param string $auth_key user authorization key.
@return string view.
For registration confirmation by email auth link .