Yii2 password hash

Nedim picture Nedim · Dec 28, 2014 · Viewed 9.9k times · Source

I'd like to know how password hash is generated?

// This is my code:

$email="[email protected]";
$password="mypassword";

// How to get password_hash variable?

$user = User::find()->where(['email'=>$email, 'password_hash'=>$password_hash])->one();
if(isset($user)){
   echo "there is";
} else {
 "Sorry!";  
}

Thank you.

Answer

David J Eddy picture David J Eddy · Jun 30, 2015

http://www.yiiframework.com/doc-2.0/guide-security-passwords.html Is how passwords are handled in Yii 2. Unless you're a crypto expert DO NOT try to write your own.