In my advanced application, after signing up it supposed to be already logged in but after signing up and trying to login it always says that I input the right credentials even though I tried testing it using "qwerty" as a password.
I haven’t done anything yet on the signup form model only the customization that is needed to match the user table.
When I check the database it records the data but everytime I login it always says that I input the wrong credentials.
public function rules()
{
return [
['username', 'trim'],
['username', 'required'],
['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'],
['username', 'string', 'min' => 2, 'max' => 255],
['email', 'trim'],
['email', 'required'],
['email', 'email'],
['email', 'string', 'max' => 255],
['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'],
['password', 'required'],
['password', 'string', 'min' => 6],
['first_name', 'required'],
['first_name', 'string', 'max' => 45],
['middle_name', 'string', 'max' => 45],
['last_name', 'required'],
['last_name', 'string', 'max' => 45],
['contact', 'required'],
['contact', 'string', 'max' => 11],
['birth_date', 'required'],
['type', 'required'],
['type', 'string', 'max' => 45],
['external_type', 'string', 'max' => 45],
['status', 'string', 'max' => 45],
['region_id', 'required'],
['barangay_id', 'required'],
['province_id', 'required'],
['city_municipal_id', 'required'],
this is the signup()
public function signup()
{
if (!$this->validate()) {
return null;
}
$user = new User();
$user->username = $this->username;
$user->email = $this->email;
$user->setPassword($this->password);
$user->generateAuthKey();
$user->first_name = $this->first_name;
$user->middle_name = $this->middle_name;
$user->last_name = $this->last_name;
$user->contact = $this->contact;
$user->birth_date = $this->birth_date;
$user->type = $this->type;
$user->external_type = $this->external_type;
$user->status = $this->status;
$user->region_id = $this->region_id;
$user->barangay_id = $this->barangay_id;
$user->province_id = $this->province_id;
$user->city_municipal_id = $this->city_municipal_id;
return $user->save() ? $user : null;
}