2016-12-20 3 views
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> 
+0

JSアラートボックスはあなたに何を伝えますか? – Tank

+0

ちょうど最初と同じように、警告ボックスに2番目のログインボックスが表示されます。 –

答えて

0

、私は答えを得た。

認証の初期化では、FormとBasicで動作するように設定しました。 Basicからコメントアウトしても問題ありません。そこには、警告ボックスはありません。

関連する問題