0
我在系統中創建了一個登錄系統,其中激活的用戶可以登錄,但帳戶未激活的用戶將無法登錄。問題是當用戶沒有輸出任何Flash消息嘗試使用停用的帳戶登錄,因此用戶不知道爲什麼頁面在登錄頁面上保持刷新。cakephp flash error not working
我的繼承人登錄功能
if ($this->request->is('post')){
if ($this->request->data['User']['password'] == 'qazwsx'){
if ($this->Auth->login()){
$username = $this->request->data['User']['username'];
if (0 === $this->User->find('count',array('conditions'=>array('activated'=>1,'username'=> $username)))) {
$this->Session->setFlash('Sorry, your account is not validated yet.');
$this->redirect($this->referer());
}
$this->Auth->user('id');
$this->redirect($this->Auth->redirect('eboxs/home'));
}
}
else {
$this->Session->setFlash('Username or password is incorrect');
}
}else{
$this->Session->setFlash('Welcome, please login');
}
}
我還沒有列入我的觀點的原因至今閃光燈的消息我還沒有不得不打電話給他們
是你的邏輯工作嗎?做'回聲'工作';退出;'在重定向和登錄前用一個已禁用的帳戶來確保。然後,檢查頁面上的用戶實際上輸出的Flash消息(因爲你正在使用'$ this-> referer()') – Ross
當我這樣做,它需要我剛剛說的工作 – user1393064
我也試過把這裏面引用代碼 死('這是一個測試'),同樣的事情發生 – user1393064