Tuesday, December 27, 2011

Re: Auth component troubles

Thanks for your suggestions Luca.

After looking at my code again this morning, I discovered my mistake.
Somehow I'd given App_Controller a ctp extension.. doh! Explains why it
wasn't being read.

Clint


> Hi,
> I think there is nothing wrong in your code, but probably your missing
> something like
>
> public function login(){
>
> if ($this->Auth->login()) {
> $this->redirect($this->Auth->redirect());
> } else {
> $this->Session->setFlash(__('Invalid username or password,
> try again'));
> } }
>
>
> in your User controller.
>
> You could use that declaration in app controller, which is more compact:
>
> class AppController extends Controller {
>
> var $components = array(
> 'Auth' => array(
> 'fields'=>array(
> 'username' => 'email',
> 'password' => 'password'
> ),
> 'loginError' => "Wrong!"
> )
> );
>
> function beforeFilter() {
> }
> }
>
> Hope this help
>
> Luca
>
>
> Il 27/12/2011 08:01, Clint ha scritto:
>> class AppController extends Controller {
>>
>> var $components = array('Auth');
>>
>> function beforeFilter() {
>> $this->Auth->fields = array(
>> 'username' => 'email',
>> 'password' => 'password'
>> );
>> $this->Auth->loginError = "Wrong!";
>> }
>>
>

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: