I suggest that you turn of autoRedirect on login, as described in
http://book.cakephp.org/view/395/autoRedirect and then use something
like the following:
[code example]
if ( !$this->Auth->user() ) {
// The user is not logged in, so try with the email as the
username!
$this->Auth->fields['username'] = 'email';
if ( $this->Auth->login() == false ) {
// Not logged in, so report errors!
}
}
[/code example]
Enjoy,
John
On Jun 4, 7:54 am, lakers fan <[email protected]> wrote:
> Hello,
>
> I have a login screen with username and password. I want to either use
> my username or email address in the username field. I tried setting the Auth
> fields as listed below but its not working.
>
> $this->Auth->fields = array('username'=>array('username',
> 'email_address'),'password'=>'password');
>
> The warning that i get is:
>
> Warning (2): Illegal offset type in isset or empty
> [CORE\cake\libs\controller\components\auth.php, line 845]
>
> Code | ContextWarning (2): Illegal offset type in isset or empty
> [CORE\cake\libs\controller\components\auth.php, line 313]
>
> Is there any other way of doing this??
>
> Thanks,
>
> Bharani
>
> _________________________________________________________________
> Windows Live™ SkyDrive™: Get 25 GB of free online
> storage.http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---