How to reset admin pass?

Hello,

I am installing yii2 and by mistake I have set a password which I cannot remember, the problem is that in the database it is encrypted, could you please let me know how to set it or if you have the original "admin" encryption.

Thank you,

Ben

Did you try the default PasswordReset thingy ? :)

Hi,

in User model there is function called setPassword()

you can use it to set password.


public function setPassword($password)

    {

        $this->password_hash = Yii::$app->security->generatePasswordHash($password);

    }

Thank you, I will give it a try.

bEN

Actually there was something so stupid to do that we did not think about it!!

Just delete the admin user and signup again! :-))

you can create new hash password and replace to past hash password in your database.
note: salt is your email account that you want restore it.
$salt= ‘omid.ahmadyani@Outlook.com’;
$pass = crypt(‘00000000’,$salt);
die($pass);