【发布时间】:2012-02-03 07:21:07
【问题描述】:
如何使用文件驱动程序更改 kohana 中用户的密码?
【问题讨论】:
标签: php kohana kohana-auth
如何使用文件驱动程序更改 kohana 中用户的密码?
【问题讨论】:
标签: php kohana kohana-auth
对于 Auth 文件驱动程序,密码存储在 Auth 配置文件 - modules/auth/config/auth.php,所以如果你想更改用户密码,你必须编辑
那个文件。默认情况下,内容如下所示:
return array(
'driver' => 'file',
'hash_method' => 'sha256',
'hash_key' => NULL,
'lifetime' => 1209600,
'session_type' => Session::$default,
'session_key' => 'auth_user',
// Username/password combinations for the Auth File driver
'users' => array(
// 'admin' => 'b3154acf3a344170077d11bdb5fff31532f679a1919e716a02',
),
);
请注意,密码是使用Auth::hash 方法加密的——您必须先使用它来获取新密码的哈希值。
您正在考虑让您的用户通过网站更改密码 - 没有好的方法,我建议改用 ORM 驱动程序。
【讨论】:
Auth::instance()->hash('my new password');