Commit f2484fd6 by Alexander Makarov

Modified application templates so when trying to log in when already logged in…

Modified application templates so when trying to log in when already logged in it just redirects to homepage instead of throwing exceptions
parent d3f5d348
......@@ -15,15 +15,10 @@ class SiteController extends Controller
'class' => \yii\web\AccessControl::className(),
'rules' => [
[
'actions' => ['error'],
'actions' => ['login', 'error'],
'allow' => true,
],
[
'actions' => ['login'],
'allow' => true,
'roles' => ['?'],
],
[
'actions' => ['logout', 'index'],
'allow' => true,
'roles' => ['@'],
......@@ -49,6 +44,10 @@ class SiteController extends Controller
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
return $this->goHome();
......
......@@ -17,10 +17,10 @@ class SiteController extends Controller
return [
'access' => [
'class' => \yii\web\AccessControl::className(),
'only' => ['login', 'logout', 'signup'],
'only' => ['logout', 'signup'],
'rules' => [
[
'actions' => ['login', 'signup'],
'actions' => ['signup'],
'allow' => true,
'roles' => ['?'],
],
......@@ -54,6 +54,10 @@ class SiteController extends Controller
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
return $this->goHome();
......
......@@ -16,14 +16,9 @@ class SiteController extends Controller
return [
'access' => [
'class' => AccessControl::className(),
'only' => ['login', 'logout'],
'only' => ['logout'],
'rules' => [
[
'actions' => ['login'],
'allow' => true,
'roles' => ['?'],
],
[
'actions' => ['logout'],
'allow' => true,
'roles' => ['@'],
......@@ -59,6 +54,10 @@ class SiteController extends Controller
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
return $this->goBack();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment