Is the issue here that you don't want to use a User model, or that you
don't want the URL to be /users/login? Or both?

For the former, you just need to do this in AppController::beforeFilter()

$this->Auth->userModel = 'Member'; // or whatever

For the latter, you can set a route like so:

Router::connect('/login', array('controller' => 'members', 'action' =>
'login'));

So, for the above, I've changed my model to Member and also changed
the route to something a bit more simple.

On Thu, Sep 17, 2009 at 2:45 PM, rboers <[email protected]> wrote:
>
> I've created a simple login system using Auth in cakephp 1.2.5.
> I have the model, app_controller, users_controller and 2 views
> (index.ctp, login.ctp) in place and everything works fine when I use
> <url>/users/login.
>
> I want to change /users/login to /<some name>/logins. Lets say I want
> to call it logins instead of users.
>
> I copy the model, app_controller and views and changed the content, so
> everything says User(s) to Login(s).
> Now every time I have a succesfull login I get redirected to the login-
> page (/logins/login) without any additional message (flash).
>
> When I change the app_controller back to users instead of logins,
> everythnig works perfect.
>
> Here is my code (logins version):
>
> app_controller.php:
>
> <?php
>
> class AppController extends Controller {
>
>        var $components = array('Auth');
>
>        function beforeFilter(){
>                $this->Auth->loginAction = array('controller' =>
> 'logins', 'action' => 'login');
>                $this->Auth->loginRedirect = array('controller' =>
> 'logins', 'action' => 'index');
>                $this->Auth->logoutRedirect = array('controller' =>
> 'logins', 'action' => 'login');
>                $this->Auth->allow('login');
>                $this->Auth->authorize = 'controller';
>        }
>
>        function isAuthorized() {
>                return true;
>   }
> }
> ?>
>
>
> login.php (model):
>
> <?php
>
> class Login extends AppModel {
>
>        var $name = 'Login';
>
>        var $validate = array(
>                'username' => VALID_NOT_EMPTY,
>                'password' => VALID_NOT_EMPTY,
>                'email' => VALID_EMAIL,
>        );
> }
> ?>
>
>
> logins_controller.php:
>
> <?php
>
> class LoginsController extends AppController {
>
>        var $name = 'Logins';
>        var $helpers = array('Html', 'Form', 'Session' );
>        var $components = array('Auth');
>
>        function index() {
>        }
>
>        function login(){
>        }
>
>        function logout(){
>            $this->redirect($this->Auth->logout());
>        }
> }
> ?>
>
> login.ctp:
>
> <?php
> $session->flash('auth');
> echo $form->create('Login', array('action' => 'login'));
> echo $form->input('username');
> echo $form->input('password');
> echo $form->end('Login');
> ?>
>
>
> index.ctp:
>
> <?
>  $session->flash('auth');
>  print "This is the index page.<br><br>";
>  echo $html->link('Logout', array('controller' => 'logins', 'action'
> => 'logout'));
> ?>
>
> Why is the code with 'Users' working perfectly, and why is the code
> with 'Logins' not working?
>
> I tried search google, google group cakephp, cakephp-website, etc. for
> days now to find a solution without any luck.
>
> Please help.
>
> Kind regards,
>
>
> Robert Boers
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to