Cake: 1.2.0.6311 beta, Mysql: 5.0
I am having more issues with the 1.2 beta Auth component.
Particularly I am trying to get around having a Users controller.
Let's say I want to use a controller named EcHere instead of Users.
When I enter, localhost/echere/login I get the login prompt served up
by my EcHere controller.
But when I enter the user name and password, I get an error because
Cake is trying to go to, localhost/users/login. So I get a missing
controller error for Users.
I stripped everything down as small as possible so I would have the
smallest post.
Here is my app_controller.php:
<?php
class AppController extends Controller {
var $components = array('Auth');
function beforeFilter() {
$this->Auth->loginAction = array('controller' => 'echere',
'action'
=> 'login');
// $this->Auth->loginRedirect = array('controller' => 'echere',
'action' => 'index');
$this->Auth->logoutRedirect = '/';
}
}
?>
And here is my EcHere_Controller.php:
<?php
class EcHereController extends AppController {
var $name = 'EcHere';
var $uses = array('Users');
var $helpers = array('Html', 'Form');
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('login');
$this->Auth->allow('register');
$this->Auth->allow('logout');
}
function index() {
}
function login() {
// only allow access to the page if user has not logged in
before
if ($this->Auth->user()) {
$this->Session->setFlash('You are already logged in.
<br />You do
not need to access the logon page again.');
$this->redirect('/echere');
exit;
}
//set the view error var to false. Used to display bad user/pass
error message
$this->set('error', false);
//if we have data
if( ! empty($this->data) ) {
//pass the data to the model so we can manually
validate things
$this->User->data = $this->data;
//validate the data, and try to authenticate the user
if ( $this->User->validates() ) {
// Nothing.
}
}
}
function logout() {
$this->Auth->logout();
$this->Session->setFlash('You have been logged out. ');
$this->redirect('/');
exit;
}
function register() {
if (!empty($this->data)) {
if ($this->data['User']['password'] ==
$this->Auth->password($this-
>data['User']['password_confirm'])) {
$this->User->create();
$this->User->save($this->data);
$this->redirect(array('action' => 'index'));
}
}
}
}
?>
Any help would be greatly appreciated.
-Rodney
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---