Dear Ahmed, how are you?

It is very very simple, you dont need to change anything in the Auth
component, anything in the login form

you just need to put this in the beforeFilter() callback of the users
controller
                if ($this->params['action']=='login' && !array_key_exists
('requested',$this->params) && !empty($this->data[$this->Auth-
>userModel])) {
                        
$this->data[$this->Auth->userModel]=array_map('trim',$this->data
[$this->Auth->userModel]);
                        
if(!empty($this->data[$this->Auth->userModel][$this->Auth->fields
['username']]) && !empty($this->data[$this->Auth->userModel][$this-
>Auth->fields['password']])) {
                                if 
(Validation::email($this->data[$this->Auth->userModel][$this-
>Auth->fields['username']])) {
                                        
$this->data[$this->Auth->userModel]['email']=mb_strtolower($this-
>data[$this->Auth->userModel][$this->Auth->fields['username']]);
                                        
unset($this->data[$this->Auth->userModel][$this->Auth->fields
['username']]);
                                        $this->Auth->fields['username']='email';
                                }
                        }
                }

please, have a nice baking day

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=.


Reply via email to