我在系统中创建了一个登录,激活的用户可以登录,但尚未激活帐户的用户将无法登录。问题是当用户尝试使用已停用的帐户登录时没有输出闪烁消息,所以用户不会知道为什么页面在登录页面上不断刷新。
这是我的登录功能
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');
}
}
到目前为止,我还没有将我的观点包含在我不必打电话给他们的闪信中