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>