Render site/login in site/index

Hey all,

I am relatively new to Yii. As I made it to implement my first User-Model and got it to work, I now want to render my site/login.php into my index.php.

Therefor, I tried it by:


if(Yii::$app->user->isGuest)

        {

            //echo $this->renderPartial("/site/login",array('model'=>new LoginForm));

            echo $this->render('/site/login',array('model' => new LoginForm()));

        }

but aparently, the Login-functionality does not work anymore (nothing happens at all). If I go onto the login-page by the navigation everythings fine.

Someone has an idea of how to manage this?

Regards!

Ideally you’d go for an ACF:

http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#access-control-filter

If you installed the application, check how it is coded in the default site controller.

Well, that was pretty easy! If you know what you have to search… Thanks a lot !