Answer the question
In order to leave comments, you need to log in
How to create a custom user in yii2?
Yii2 has its own user, I am making new functionality for the old database, but the problem is that all users already exist, and there is only one column with a password in the table with the user. Is it possible to somehow customize the framework user for a specific table?
Answer the question
In order to leave comments, you need to log in
If the password in the old database is not hashed and stored in its original form, then pay attention
here:
www.yiiframework.com/doc-2.0/yii-base-security.html
and specifically on the generatePasswordHash() method.
Here are the methods for generating an authorization key and a hash password:
public function setPassword($password)
{
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
}
public function generateAuthKey()
{
$this->auth_key = Yii::$app->security->generateRandomString();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question