Hi Joe, 
Happy New Year!

I'm sorry for delaying reply you.
> Is that the actual data in `users`, or just simplified for example? Just 
want to clarify. Manually adding records won't work in this case. 
It is the actual data which is storing in my `users` table.

> Auth automatically encrypts the submitted password & compares it to the 
database value. If you enter '123' as the password, it's not going to match 
'123' in the database after Auth encrypts it.
I don't know this issue, but entered the password `123` just as it have 
been stored in my table.
Maybe this is the problem...I'll check it.

> Obviously, adapt the CTP form to your TAL needs.
What this means? Are you talking about the usage in my controller but not 
html(TAL) files for login?

Regards,
tech_me


On Tuesday, December 23, 2014 11:35:40 PM UTC+9, Joe T. wrote:
>
> Is that the actual data in `users`, or just simplified for example? Just 
> want to clarify. Manually adding records won't work in this case. Auth 
> automatically encrypts the submitted password & compares it to the database 
> value. If you enter '123' as the password, it's not going to match '123' in 
> the database after Auth encrypts it.
>
> Look here for how to set up adding/editing users: 
> http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
> Obviously, adapt the CTP form to your TAL needs.
>
> Hope that helps...
> -joe t.
>
>
> On Monday, 22 December 2014 20:42:33 UTC-5, tech_me wrote:
>>
>> By the way, I have a table `users` in my db, which have 2 records.
>> id,   email,  password
>> 1001, abc@com, 123
>> 1002, abc@org, 456
>>
>> When I input email and password on the login form, it fails at `if 
>> ($this->Auth->login())`
>>
>>
>> On Tuesday, December 23, 2014 10:39:39 AM UTC+9, tech_me wrote:
>>>
>>> In my view file(html)
>>> <form method="POST" tal:attributes="action string:/users/login">
>>>     <input type="text" name="email" size="15" maxlength="30" placeholder
>>> ="your email" /><br />
>>>     <input type="password" name="password" size="15" maxlength="15" 
>>> placeholder="password" /><br />
>>>     <input type="submit" value="login" />
>>> </form>
>>>
>>> In my AppController.php
>>>     public $components = array('RequestHandler',
>>>             'Auth' => array(
>>>                     'authenticate' => array(
>>>                             'Form' => array('userModel' => 'User',
>>>                                     'fields' => array('username' => 
>>> 'email',
>>>                                             'password' => 'password'))),
>>>                     'loginAction' => array('controller' => 'users', 
>>> 'action' => 'login'));
>>>
>>>     public function beforeFilter() {
>>>         $this->Auth->allow('login', 'logout');
>>>     }
>>>
>>> In my UsersController.php
>>>     public function login() {
>>>         if ($this->request->is('post')) {
>>>                    if ($this->Auth->login()) {
>>>                     return $this->redirect($this->Auth->redirect());
>>>             } else {
>>>                         echo ('failed'); // Always come here...
>>>             }
>>>         }
>>>     }
>>>
>>>     public function logout() {
>>>         $this->Auth->logout();
>>>         $this->Session->destroy();
>>>         $this->redirect(array('action' => 'login'));
>>>     }
>>>
>>> Could you give some hints, please?
>>> Thank you.
>>>
>>>
>>> On Sunday, December 21, 2014 4:48:14 PM UTC+9, tech_me wrote:
>>>>
>>>> 1. Yes
>>>> 2. Yes
>>>> 3. No any error but just failed(false) at that `if` statement.
>>>> 4. Maybe there is no the same name field in my user table, which is 
>>>> 'email' in html while 'nickname' in table schema
>>>>
>>>> I will have a try soon.
>>>> Thank you.
>>>>
>>>>
>>>> On Friday, December 19, 2014 4:55:03 AM UTC+9, John Andersen wrote:
>>>>>
>>>>> Please provide more information on the steps leading up to the error 
>>>>> that you get.
>>>>> 1. Is the login form showing?
>>>>> 2. Can you submit the form?
>>>>> 3. Do you get the error back from your login method - wrong e-mail or 
>>>>> password?
>>>>> 4. Something else?
>>>>>
>>>>> Suggest that you at least create the users table and add one user, so 
>>>>> that CakePHP has something to work with.
>>>>>
>>>>> Enjoy, John
>>>>>
>>>>> On Wednesday, 17 December 2014 14:14:43 UTC+2, tech_me wrote:
>>>>>>
>>>>>> I posted to SO several days ago, but no expected replies.
>>>>>> http://stackoverflow.com/q/27403391
>>>>>>
>>>>>> I am now using PHPTAL <http://phptal.org/> which use html instead of 
>>>>>> ctp files.
>>>>>> Is there anyone who use the html files to cooperate with Cake's 
>>>>>> authentication?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>
>

-- 
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