Search Results

Search found 1 results on 1 pages for 'hellosheikh'.

Page 1/1 | 1 

  • cakephp phone number validation

    - by hellosheikh
    i am new to cakephp 2.x so i dont know how to do this .. i want to login the user from his email address and phone number..what my intention is if the number in database is this "12345" and the user is trying to login through this number "+12345" he can be login into the system.. i have written a code but i dont know how can i use this or to adjust my code within the auth component as the auth component is autometically logging the user .. here is my controller public function beforeFilter() { parent::beforeFilter(); $this->Auth->authenticate = array( 'Authenticate.Cookie' => array( 'fields' => array( 'username' => 'email', 'password' => 'password' ), 'userModel' => 'User', 'scope' => array('User.active' => 1) ), 'Authenticate.MultiColumn' => array( 'fields' => array( 'username' => 'email', 'password' => 'password' ), 'columns' => array('email', 'mobileNo'), 'userModel' => 'User', ) ); } public function login() { if ($this->Auth->login() || $this->Auth->loggedIn()) { $this->redirect('/users/dashboard'); }else{ $this->layout='logindefault'; $this->set('title_for_layout', 'Account Login'); /*$this->Auth->logout(); $cookie = $this->Cookie->read('Auth.User'); */ if ($this->request->is('post')) { if ($this->Auth->login() || $this->Auth->loggedIn()) { if ($this->Session->check('Auth.User')){ $this->_setCookie($this->Auth->user('idUser')); $this->redirect('/users/dashboard'); } }else { $this->Session->setFlash('Incorrect Email/Password Combination'); } }} } here is the code which i am trying to add .. $mobileNo='+123456789'; if (strpos($mobileNo,'+') !== false) { $mobileNo=str_replace("+", "",$mobileNo); } ?

    Read the article

1