-
-
Save ashutoshdev-zz/61ac71ae635a40f09c4c to your computer and use it in GitHub Desktop.
Revisions
-
fitorec revised this gist
Jun 28, 2012 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,16 +8,15 @@ public function login() { if($this->request->is('post')) { App::Import('Utility', 'Validation'); if( isset($this->data['User']['username']) && Validation::email($this->data['User']['username'])) { $this->request->data['User']['email'] = $this->data['User']['username']; $this->Auth->authenticate['Form'] = array('fields' => array('username' => 'email')); } if(!$this->Auth->login()) { $this->Session->setFlash(__('Invalid username or password, try again')); } else { $this->redirect($this->Auth->redirect()); } } } -
fitorec revised this gist
Jun 28, 2012 . 1 changed file with 11 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,23 @@ <?php /* Cakephp 2 * Login with email or username * Link: http://www.netboy.pl/2011/08/cakephp-auth-component-login-with-username-or-e-mail/#comment-9560 */ public function login() { if($this->request->is('post')) { App::Import('Utility', 'Validation'); if( isset($this->data['User']['username']) && Validation::email($this->data['User']['username'])) { $this->request->data['User']['email'] = $this->data['User']['username']; $this->Auth->authenticate['Form'] = array( 'fields' => array('username' => 'email') ); } if(!$this->Auth->login()) { $this->Session->setFlash(__('Invalid username or password, try again')); } else { $this->redirect($this->Auth->redirect()); } } } -
fitorec created this gist
Jun 28, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ <?php /* Cakephp 2 * Login with email/username * Link: http://www.netboy.pl/2011/08/cakephp-auth-component-login-with-username-or-e-mail/#comment-9560 */ public function login() { if( $this->request->is('post') ) { App::Import('Utility', 'Validation'); if( isset($this->data['User']['username']) && Validation::email($this->data['User']['username']) ) { $this->request->data['User']['email'] = $this->data['User']['username']; $this->Auth->authenticate['Form'] = array('fields' => array('username' => 'email')); } if( ! $this->Auth->login() ) { $this->Session->setFlash(__('Invalid username or password, try again')); } else { $this->redirect($this->Auth->redirect()); } } }