0
私がしたいことは、フラッシュプロンプトが表示されますが、別のログイン用の電子メール/パスワードボックスが付いたJS警告ボックスが表示され続けます。ログイン失敗時に警告ボックスを表示するCakephp 2アプリ
認証はコントローラで
class AppController extends Controller {
public $components = array('Auth' => array(
'loginAction' => array(
'controller' => 'Customers',
'action' => 'login'
),
'authError' => 'Please log in',
'authenticate' => array(
'Form' => array(
'fields' => array(
'username' => 'Email',
'password' => 'password'
)
)
)
), 'Security', 'AntiXss', 'Cookie', 'DebugKit.Toolbar', 'Session');
public $helpers = array('Js', 'Html', 'Form', 'Number', 'DateFormat', 'Currency', 'Session');
public $uses = array('Language', 'Customer', 'Affiliate', 'Setting', 'Whitelabel');
がHERESに私のログイン機能に定義された相続人のAppController:
function login() {
if($this->loggedCustomerData) { $this->redirect("/"); } // If user is logged in, redirect to home
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirect('/accounts/'));
} else {
$this->Session->setFlash(__('Username or password is incorrect'), 'default', array(), 'auth');
}
}
}
そして、私が持っている私のデフォルトのビューで:まあ
<div id="container">
<?php
echo $this->Session->flash();
echo $this->Session->flash('auth');
?>
</div>
JSアラートボックスはあなたに何を伝えますか? – Tank
ちょうど最初と同じように、警告ボックスに2番目のログインボックスが表示されます。 –