問題描述
我在 cakephp 2.4 中遇到了登錄頁面 (I'm getting stuck with login page in cakephp 2.4)
我在 cakephp 2.4 中的登錄頁面卡住了,誰能幫我弄清楚我犯了什麼錯誤。太感謝了!(為什麼我在查詢的WHERE子句中沒有看到密碼??)
這裡是sql文件,項目文件和兩張圖片描述了問題:
SQL 文件:dropbox.com/s/b4pv419j09rp5jk/chickenrainshop.sql?dl=0
項目文件:dropbox.com/s/kextdrpzizyskwd/chickenrainshop.zip?dl =0
參考解法
方法 1:
You're not seeing the password column in the WHERE
clause because Cakes authentication layer compares passwords at PHP level, using the configured password hasher, which by default is SimplePasswordHasher
(at least in CakePHP 2.x), using sha1
, sha256
, or md5
, depending on what's available on the system (in that order, and in any case salted with the Security.salt
config value).
The password values in your database are most probably both wrong, the first one looks like md5
, which is unlikely to be used by your app, and the second one is a plain string, which will never work.
So as already hinted in the comments, update your database with the correct password hashes. Ideally add the users to your database via your app.
See also
- Cookbook > Libraries > Components > Authentication > Hashing Passwords
- https://github.com/cakephp/cakephp/blob/2.4.10/lib/Cake/Utility/Security.php#L122‑L136
(by Nhan Nguyen、ndm)