muyuym / yii2-adminlte3

adminlte3 for yii2
BSD 3-Clause "New" or "Revised" License
75 stars 30 forks source link

Login view #3

Closed jashirouprotips closed 4 years ago

jashirouprotips commented 4 years ago

Hi,

I have an issue with the login view.

My boss want the classic login form, where the form is alone and the others elements (sidebar and navbar) are not included in the "site/login" route.

How can I change this: image

To this?: image

I will really very thankfully.

Thanks in advance.

muyuym commented 4 years ago

Hi @jashirouprotips,

You should set the layout to 'main-login' or false.

    public function actionLogin()
    {
        // $this->layout = 'main-login';
        $this->layout = false;

        if (!Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        } else {
            $model->password = '';

            return $this->render('login', [
                'model' => $model,
            ]);
        }
    }
jashirouprotips commented 4 years ago

Hi @jashirouprotips,

You should set the layout to 'main-login' or false.

    public function actionLogin()
    {
        // $this->layout = 'main-login';
        $this->layout = false;

        if (!Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        } else {
            $model->password = '';

            return $this->render('login', [
                'model' => $model,
            ]);
        }
    }

Excellent...you saved my day...

Thanks again dude...well done with this plugin...