0
votes

All I want the thing to do is come up with a flash prompt, but it keeps giving me a JS alert box with another login Email/Password box.

Heres the AppController where Auth is defined

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 my login function in the controller:

 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');
                     }
             }
    }

And in my default view I have:

 <div id="container">
            <?php
            echo $this->Session->flash();
            echo $this->Session->flash('auth');
            ?>
  </div>
1
What does the JS Alert box tell you?Tank
It just gives me a second log in box, exactly like the first, but in an alert box.Owen Percoco

1 Answers

0
votes

Well, I got the answer.

In the authentication initialization, I set it to work on Form, and Basic. Comment out Basic and it works just fine. There you go, no alert box.