controllers/RegistrationController.php
public function actionConfirm($id, $code)
	{
		$user = UserIdentity::findByActivationToken($id, $code);

		if ($user == NULL)
			throw new NotFoundHttpException;

		if (!empty($user)) {
			$user->activation_token = NULL;
			$user->status = User::STATUS_ACTIVE;
			$user->save(FALSE);

			Yii::$app->session->setFlash('success', Yii::t('user', 'Account ' . $user->email . ' has successfully been activated'));
		} else
			Yii::$app->session->setFlash('error', Yii::t('user', 'Account ' . $user->email . ' could not been activated. Please contact the Administrator'));

		return $this->render('confirm', ['user' => $user]);
	}
public function actionConfirm($id, $code)
	{
		$user = UserIdentity::findByActivationToken($id, $code);

		if ($user == NULL)
			throw new NotFoundHttpException;

		if (!empty($user)) {
			$user->activation_token = NULL;
			$user->status = User::STATUS_ACTIVE;
			$user->save(FALSE);

			Yii::$app->session->setFlash('success', Yii::t('user', 'Account ' . $user->email . ' has successfully been activated'));
		} else
			Yii::$app->session->setFlash('error', Yii::t('user', 'Account ' . $user->email . ' could not been activated. Please contact the Administrator'));

		return $this->render('confirm', ['user' => $user]);
	}
Confirms user's account.

@param integer $id   User Id
@param string  $code Activation Token

@return string
@throws \yii\web\NotFoundHttpException