Comments (18)
You DB column is probably too short, bcrypt hashes are much longer than sha1's. If you are using a fixed length column they will be truncated.
from app.
what is not working exactly? Password hasher were recently changed in 3.0, you may want to take a look at the auth tutorial again and perhaps manually reset passwords for your current database if it is an option for you. In the future, please open tickets in cakephp/cakephp
from app.
I am not able to login after submit on login button, always going in else part.
I am giving right username and password.please look in to my auth login code.
I followed all steps for authentication.
https://gist.github.com/archanavhire/1460ebc16a7510d8d589
from app.
Can you debug if the hashed password match? Go into the BaseAuthenticate class and debug the hashed password value and compared to the one in the database
from app.
I found the bug, which is in FormAuthenticate class. _checkFields of FormAuthenticate class return false because of username field(In my form it is email). but I already mention in app controller for email field instead of username.
Still not able to fix this bug.
from app.
The problem was in your config
$this->Auth->config('authenticate', ['Form'=>['username'=>'email','password'=>'password']]);
you are missing the fields
key. It should be
$this->Auth->config('authenticate', ['Form'=>['fields' =>['username'=>'email','password'=>'password']]]);
from app.
problem is in $this->passwordHasher()->check($password, $result[$fields['password']]) function which is in BaseAuthenticate class.
function is returning false even if I got result array.
from app.
Can you go into the hasher code and compare what it produces versus what you have stored in the database?
from app.
Yes I did it and I found record in database. It is also returning result in $result variable.
But after that its again checking passwordHasher which is returning false.
from app.
you're still not answering my question, how does the password stored in your database compare to what the password hasher is producing?
from app.
I stored password in blowfish hash code which is 50 char.
App\Model\Entity\User.php
from app.
can you paste here the password stored in your database and the one that is checked in the password hasher class?
from app.
In database :
$2y$10$6dab8w1rJ0RP411hkl.B8OBwzwaK0ZgnZoR7/XjmBPo
in result variable:
[password] => $2y$10$6dab8w1rJ0RP411hkl.B8OBwzwaK0ZgnZoR7/XjmBPo
from app.
ok, I got it.
In $this->passwordHasher()->check($password, $result[$fields['password']]) function
$password is in simple text and $result[$fields['password']] is hashed so that its returning false.
from app.
Both passwords are the same, how come the password checker returns false then? Can you help us debug that?
from app.
If you are using the laters CakePHP 3.0, please use SimplePasswordHasher instead of Blowfish
from app.
As you suggested me, I switched from Blowfish to SimplePasswordHasher. But still authentication is not working because password is not matching.following code returning false.
password_verify($password, $hashedPassword);
password return by hasher :
'$2y$10$dDcxwWtDJVYnRfNX.wIBJuQdokyX65ZpaQCcqvQSQOiGH7yf7HMAG'
password in my db:
'$2y$10$HJ9urHeVBzXezb0Hh13AJeU3PquK2f4yLIrl9bHNVWl'
My updated gist link is:
https://gist.github.com/archanavhire/842266d5953c0df413f2
from app.
Thank you very much. Now its working.
:)
from app.
Related Issues (20)
- robots.txt HOT 3
- Uloma cart
- Mysql/MariaDB UTF8 defaults HOT 3
- H
- dd use vendor\sympfony\var_dumper\dump.php instead vendor\cakephp\cakephp\src\basic.php HOT 4
- Filmes e séries
- CSRF Token missing in error template HOT 7
- Locales path is wrong HOT 1
- Incorrect cache engine name in home page
- Tests fail not in debug mode HOT 1
- test/bootstrap.php and 'App.fullBaseUrl' HOT 3
- Error in session overwrite
- No installs cakephp/cakephp v4.4.4 (current) HOT 1
- Add git support for next gen picture. HOT 2
- Skip using ErrorHandlerMiddleware in cli mode HOT 3
- Re-enable migration plugin for 5.x once it's compatible with Cake 5 HOT 2
- Bug in new version of app for BeforeFilter / BeforeRender
- Unused config options _cake_routes_ HOT 1
- Global function usage only in error with phpstan but not in production/unit test despite migration doc HOT 5
- Error templates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from app.