I'm using othAuth in my current project. The way it worked for me - I
don't have this special route specified:
$Route->connect('/admin', array('controller' => 'users', 'action'
=>'login'));

Instead, I have my '/admin' url pointing to one of my CMS sections:
### routes.php
    $Route->connect('/admin', array('controller' => 'texts', 'action'
=> 'index', 'admin' => 1));

Note that last parameter passed: 'admin' => 1. This is the way to
specify in your routes that an action should use admin routes. This is
a fully valid reason why your route wouldn't work by the way. You have
admin_login() action and you haven't specified that it should use
admin routes in your routes file.

Anyways, I wouldn't recommend hard-coding this with a route, use a
noaccess redirect by means of oth_auth mechanisms instead:

If you set the othAuth settings properly you'd get redirected to /
admin/users/login if you try to access a page that needs specific
permissions. In my case:

### components/oth_auth.php:

    // these get overwritten in beforeFilter() - read on.
    var $login_page    = '/users/login';
    var $noaccess_page = "/users/login";

// I've also set a 7-day cookie so that I don't have to login every
time the session expires. I'll revise the cookie lifetime when i'm
ready for production
    var $cookie_active    = true;
    var $cookie_lifetime = '+7 day';

### helpers/oth_auth.php
    var $othAuthRestrictions = array(CAKE_ADMIN);

    function beforeFilter() {
        $auth_conf = array(
            'mode'  => 'oth',
            'auto_redirect' => true,
            'login_page'  => '/admin/users/login',
            'logout_page' => '/admin/users/logout',
            'access_page' => '/admin/texts/index',
            'hashkey'     => 'aphrazeofyourchoice',
            'noaccess_page' => '/admin/users/noaccess',
            'strict_gid_check' => false,
        );

This way, if someone tries: http://mydomain.com/admin/ and is not
currently identified as a user with the corresponding permissions they
would be redirected to /admin/users/login per-othAuth settings.

If the user has been identified (remember that long cookie lifetime?)
they would be redirected to /admin/texts/index instead per my '/admin'
route above.

HTH,
Nasko

On Jun 26, 1:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I've got the following code in routes.php:
>
> $Route->connect('/admin', array('controller' => 'users', 'action' =>
> 'login'));
> $Route->connect('/', array('controller' => 'pages', 'action' =>
> 'display', 'home'));
> $Route->connect('/pages/*', array('controller' => 'pages', 'action' =>
> 'display'));
> $Route->connect('/tests', array('controller' => 'tests', 'action' =>
> 'index'));
>
> I'm using the OthAuth-component.
> And the default admin routing CAKE_ADMIN is turned on, in core.php.
>
> Due to the default admin routing the login method is called
> admin_login.
>
> I would love to use the following link so an admin gets redirected to /
> admin/users/login
> <mysite>/admin
>
> When using the link above I get the following message.
> "Missing Method in UsersController"
>
> Anybody?


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to