When I visit my login page, the loginerror is always on the top of the
page. I can login, that is no problem.
I have the following files:
<?php
class UsersController extends AppController {
var $name = 'Users';
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index', 'login', 'logout', 'register');
$this->data['User']['password'] = $this->Auth->password($this->data
['User']['password']);
}
function index() {
}
function login() {
}
function register() {
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->Session->setFlash('U bent geregistreerd! Nu kunt u
hieronder inloggen.');
$this->redirect(array('action' => 'login'));
}
}
}
function logout() {
$this->Session->setFlash('U bent uitgelogd.');
$this->redirect(array('action' => 'login'));
}
}
?>
<?php
class AppController extends Controller {
var $components = array('Auth');
function beforeFilter() {
parent::beforeFilter();
$this->Auth->userModel = 'User';
$this->Auth->fields = array('username' => 'email', 'password' =>
'password');
$this->Auth->loginAction = array('admin' => false, 'controller' =>
'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'users', 'action'
=> 'index');
$this->Auth->loginError = 'Foute email/wachtwoord combinatie.
Probeer opnieuw.';
}
}
?>
<h2>Inloggen</h2>
<?php
echo $form->create('User', array('action' => 'login'));
echo $form->input('email');
echo $form->input('password');
echo $form->end('Login');
?>
Can you please tell me how to change the files so the loginerror only
shows when you login incorrect?
And I have another question, can you redirect a logged in user to the
$this->Auth->loginRedirect page when he is visiting the login page?
Thank you,
Bart
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment