The hash can then be associated with the corresponding model attribute, so it can be stored in the database for later use.
...
...
@@ -34,7 +34,7 @@ if (Security::validatePassword($password, $hash)) {
Generating Pseudorandom data
-----------
Pseudorandom data is useful in many situations. For example when resetting a password via email you need to generate a token, save it to the database, and send it via email to end user which in turn will allow them to prove ownership of that account. It is very important that this token be unique, else there is a possibility and attacker can predict the token's value and reset the user's password.
Pseudorandom data is useful in many situations. For example when resetting a password via email you need to generate a token, save it to the database, and send it via email to end user which in turn will allow them to prove ownership of that account. It is very important that this token be unique and hard to guess, else there is a possibility and attacker can predict the token's value and reset the user's password.
Yii security helper makes generating pseudorandom data simple:
...
...
@@ -54,7 +54,7 @@ For example, we need to store some information in our database but we need to ma
```php
// $data and $secretKey are obtained from the form