I am using Yii2-user for user management and it works great. However, in order to log in the user must be directed to /user/security/login. I would like to have the login form on the index page. Simply copying the form from Yii2-user’s login.php view file does not seem to be enough, because then $model means nothing.
Do I need to reference dektrium’s namespace or add a ‘use’ statement for Yii2-user’s models, controllers… ?
I haven’t used the yii2-user package you’re talking about, but you have a few widgets. You could separate out the login form and create a log in form widget. This would allow you to drop it anywhere throughout your application with relative ease. Otherwise you just need to copy code over to your index controller/action (i.e. copy the code in the existing log in controller action to your index controller action, and pass the data variables [$model] through to your view).
Thank you. I think using a widget is indeed the easiest way of moving the login form around. In fact, Yii2-user’s developer already has the widget built with this very idea, I think.
hi iam using “sintret/yii2-chat-adminlte”: “dev-master” extension for chat app.while runing the program it show error class Class ‘app\models\User’ not found…what i do??