我正在处理忘记密码,我想使用 rand() 发送新密码。将密码发送到客户电子邮件后,我想使用散列更新新密码,但我不知道该怎么做?请帮我解决这个问题?
代码:
$hash = Security::hash('CakePHP Framework');
error : Class 'App\Controller\Security' not found
最佳答案
只需在 Controller 中使用以下行。
use Cake\Auth\DefaultPasswordHasher;
现在您可以使用以下代码手动散列您的密码。
$password = "Your Password";
$hasher = new DefaultPasswordHasher();
$hasher->hash($password);
关于hash - 如何手动在 cakephp 3 中进行密码散列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34216340/