Signup page sample url -
http://localhost/yii2project/frontend/web/index.php?r=site/signup
But you can not login, when you try to login after successful signup. Login page sample url -
http://localhost/yii2project/frontend/web/index.php?r=site/login
The problem is due to USER STATUS value check in "function findByUsername()" while login that is written in the Yii2 User class file or model, which are -
STATUS_DELETED = 0
STATUS_INACTIVE = 9
STATUS_ACTIVE = 10
User class file path and code - yii2project/common/models/Users.php
public static function findByUsername($username) { return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); }Yii2 framework assigns the user STATUS = 9 to the user after signup in the database table - "user" as screenshot below -
Yii2 gets new registered user status INACTIVE, that is why you get - "Incorrect username or password" error.
You need to edit or update the user status field to 10 in the user table and then try to login. The login activity will work successfully.

0 comments:
Post a Comment