Learning Yii Testing by 2015

Learning Yii Testing by 2015

Author:2015
Language: eng
Format: mobi, epub
Publisher: Packt Publishing


This means that we will need to create the password hash first by using the aforementioned helper class, set it in the user, and then can use the $user->validatePassword() method to check whether the actual cleartext password that is passed matches the internal one. Some sort of encryption/decryption should happen behind the curtains, ideally by using Security::validatePassword() from the security component.

A possible implementation of User::validatePassword() in the user model can be the following:

// models/User.php /** * Validates password * * @param string $password password to validate * @return boolean if password provided is valid for current user */ public function validatePassword($password) { return Yii::$app->getSecurity()->validatePassword($password, $this->password); }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.