Hi John,

Sorry for replying late.
I have been very busing recently and have less time to continue on this 
issue.

Today I make some time to try your solution, got a good result and a bad 
one:
- GOOD
`passwordHasher`, yes, it worked.
It saved hashed password(123) against id(1001) to my table, which is 
**f034a6b0709eb2b2bd1b2eb47987ab6e334ca7a6**(40 chars?!)

- BAD
Nothing changed, `$this->Auth->login()` still returning `false`. 


ADDITIONAL
I have two input elements in my html(with PHPTAL), theirs `name` attributes 
are `username` and `password`,
while there are `id` and 'password' fields in my table.
So
`
...
'authenticate' => array(
                            'Form' => array('userModel' => 'User',
                                    'fields' => array('username' => 'id',
                                            'password' => 'password'))),
...
`
is there anything incorrect?

Thank you, tech_me


On Friday, January 16, 2015 at 2:48:09 AM UTC+9, John Andersen wrote:
>
> You have a users table with two records, where the one with id = 1001 has 
> the password = 123. The password needs to be changed to the hashed value 
> that Auth/password hasher can provide to you.
>
> Make sure that your password column in the table has a definition that can 
> contain a hashed password - think it should be 32 character (please correct 
> me if I am wrong).
>
> As a temporary solution (other may provide a better one :)
>
> In you controller, at the beginning of the login method, add this:
> // Make user 1001 the current in the User model
> $this->User->id = 1001;
>
> // Activate the simple password hasher and hash the password '123'.
>
> $passwordHasher = new SimplePasswordHasher();
> $pw1001 = $passwordHasher->hash('123');
>
>
> // Save the password to the hashed value of 123 for the current user 1001
> $this->User->saveField('password', $pw1001);
>
> Then try to login only once and check your database to see whether or not 
> the password has changed value to something
>
> If the password in the table has changed, then comment out the above code 
> and try to login again using password 123.
>
> Enjoy, John
>
>
> On Thursday, 15 January 2015 16:37:37 UTC+2, tech_me wrote:
>>
>> Hi John,
>>
>> > Use the password hasher to hash your password, then save it instead of 
>> "123" and it should work.
>> So could I put hasshed password to table without create new user record?
>> I have read your link, but there is just creating user...
>>
>> Besides users, lots of tests are able to be tested just by searching but 
>> not creating new record for those purposes.
>>
>> Thanks, tech_me 
>>
>>
>> On Thursday, January 15, 2015 at 5:15:16 AM UTC+9, John Andersen wrote:
>>>
>>> Use the password hasher to hash your password, then save it instead of 
>>> "123" and it should work.
>>>
>>> See the CakePHP book at this location for the password hasher:
>>>
>>> http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#hashing-passwords
>>>
>>> Enjoy, John
>>>
>>> On Sunday, 11 January 2015 13:52:07 UTC+2, tech_me wrote:
>>>>
>>>> > If '123' is the actual data in your password field in the data 
>>>> record, it's very likely this is the problem you're having with logging in.
>>>> Maybe this is the problem;)
>>>>
>>>> [snip]
>>>>
>>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to