나는 cakephp 2.x에 익숙하지 않기 때문에 이것을하는 법을 모른다. 나는 그의 이메일 주소와 전화 번호에서 사용자를 로그인하고 싶다. 내 의도는 데이터베이스에있는 숫자가 무엇인지이다. 이 "12345"및 사용자가이 번호 "+12345"를 통해 로그인하려고 시도하는 중입니다. 시스템에 로그인 할 수 있습니다. 코드를 작성했지만이를 사용하거나 인증 구성 요소 내에서 코드를 조정하는 방법을 모르겠습니다. 정식 구성 요소가 autometically 사용자가 로그온하는 것처럼 ... ..cakephp 전화 번호 확인
여기 여기 내 컨트롤러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');
}
}}
}
입니다 내가 추가하려고하고있는 코드는 6,
$mobileNo='+123456789';
if (strpos($mobileNo,'+') !== false) {
$mobileNo=str_replace("+", "",$mobileNo);
}
?>
당신이 그렇지 않으면 그것까지 .. 어떻게 내가 갇혀 나처럼 마음을 해달라고하면 다음 코드를 공유하기 전에 구현 또는이 기능에 작업 한 경우 여기 지금 바로 – hellosheikh
didnt는 당신을 얻는다. .. 나는 누구를 바꾸고있다. .. 내가해야하고 싶은 것이. .. 내가 이메일, 번호와 숫자에서 사용자에게 로그인하고 싶다. .. – hellosheikh
정확하게 arent 당신은 당신의 메소드에서'str_replace'를 사용하여 형식을 "통일"합니까? 그 코드를 컨트롤러 또는 모델의 고유 한 메소드 또는 인라인으로 배치하십시오. – mark