public function actionMy() { if (\yii::$app->user->can('UserAccountMy')) { $account = User::findIdentity(\Yii::$app->user->identity->id); $profile = UserProfile::find()->where(['id' => \Yii::$app->user->identity->id])->one(); // ::search(['id' => \Yii::$app->user->identity->id ]); return $this->render('my', ['account' => $account, 'profile' => $profile, 'roles' => \Yii::$app->authManager->getRolesByUser(\Yii::$app->user->identity->id), 'module' => $this->module]); } else { throw new \yii\web\NotAcceptableHttpException('No Permission to view my data '); } }
public function actionBackendLogin() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { $user = User::findIdentity(Yii::$app->user->identity->id); $user->touch('last_visited'); return $this->goBack(); } else { return $this->render('backend-login', ['model' => $model]); } }