Пример #1
0
 public function actionLoginByToken($id, $token)
 {
     if (self::getAdminModule()->allowLoginViaToken == false) {
         throw new NotFoundHttpException();
     }
     /** @var User $user */
     $user = User::findOne($id);
     if ($user === null) {
         throw new NotFoundHttpException();
     }
     $token = AdminLoginToken::compareToken($user->id, $token);
     if ($token === null) {
         throw new ForbiddenHttpException();
     }
     $token->delete();
     \Yii::$app->user->login($user);
     return $this->goHome();
 }