Auth login z e-mailem lub telefonem komórkowym Cakephp
Pracuję nad cakephp 2.x.i mam tabelę w mojej nazwie bazy danychużytkownik i ma 4 polaid, email, hasło i mobileNo
mam dwa pola w moimlogin.ctp
<?php
echo $this->form->create();
echo $this->form->input('email');
echo $this->form->input('password');
echo $this->form->end('submit');
?>
czego chcę to, aby zalogować się na użytkownika z jego telefonu komórkowego również (jeśli wpisał numer telefonu komórkowego, a nie adres e-mail), tak jak zrobił to Facebook. pole .. nie wiem jak mogę to zrobić tutaj jest mój kod
AppController
class AppController extends Controller {
public $components = array(
'Session',
'Auth'=>array(
'loginRedirect'=>array('controller'=>'users', 'action'=>'admin'),
'logoutRedirect'=>array('controller'=>'users', 'action'=>'admin'),
'authError'=>"You can't access that page",
'authorize'=>array('Controller'),
'authenticate' => array(
'Form' => array(
'fields' => array('username' => 'email')
)))
);
)
);
public function isAuthorized($user) {
}
public function beforeFilter() {
$this->Auth->allow('index');
}
}
UserController
public function login()
{
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash('Your email/password combination was incorrect');
}
}
}