Authentication
Most web applications provide a way for users to log in or reset their forgotten passwords. In Yii2, we don't have this opportunity by default. For a basic application template, Yii provides only two test users by default, which are statically described in the User model. So, we have to implement special code to be able to enable user login from the database.
Getting ready
Create a new application by using the Composer package manager, as described in the official guide at http://www.yiiframework.com/doc-2.0/guide-start-installation.html.
In the component section of your config, add:
'user' => [ 'identityClass' => 'app\models\User', 'enableAutoLogin' => true, ],Create a
Usertable. Create a migration by entering the following command:./yii migrate/create create_user_tableUpdate the just created migration with the following code:
<?php use yii\db\Schema; use yii\db\Migration; class m150626_112049_create_user_table extends Migration { public function up...