Hey...
I dont know but there is a different treatment for constructing the url in
auth.php that will be stored for the purpose of restoring the redirection
url.
Around line number 270 in auth.php
if (is_array($this->loginAction)) {
$params = $controller->params;
$keys = array('pass', 'named', 'controller', 'action',
'plugin');
$url = array();
foreach($keys as $key) {
if (!empty($params[$key])) {
if (is_array($params[$key])) {
foreach ($params[$key] as $name => $value) {
$url[$name] = $value;
}
} else {
$url[$key] = $params[$key];
}
}
}
} elseif (isset($controller->params['url']['url'])) {
$url = $controller->params['url']['url'];
}
so for a temporary change/fix i changed the loginAction to be string based
instead of array based.
initially :
$this->Auth->loginAction = array('controller'=>'invites', 'action'=>'index);
Changed it to:
$this->Auth->loginAction = '/invites/';
the string based url works and my custom routes work fine.. Would appreciate
if some one could throw some light on this behavior in Auth.php.
Thanks.
On Tue, Jan 6, 2009 at 5:41 PM, Novice Programmer
<[email protected]>wrote:
> Hey WebWeave,
>
> I dont know but loginRedirect should not cause any issues for routing.. Its
> there only to handle the cases if there is nothing in the session variable
> Auth.Redirect. I just saw the code which stores Session.redirect
>
> Around line number 289 in components auth.php
> $url = Router::normalize($url);
>
> this returns the full url to the controller/action pair rather than
> considering the url formed using the routes.
>
> So if i have some thing like follows in my routes.php:
> Router::connect('/:uid/*', array('controller' => 'entities', 'action' =>
> 'view'));
>
> but the above code stores the value /entities/view in the Session
> Auth.redirect and completely skips the uid part of the entity.
>
> any help would be appreciated
>
> Thanks.
>
>
> On Tue, Jan 6, 2009 at 12:16 AM, Webweave <[email protected]> wrote:
>
>>
>> Don't set the loginRedirect in your beforeFilter, and then just use
>> $this->Auth->redirect() in your login function as follows:
>>
>>
>> /**
>> * Login function - this is where we do the login ...
>> */
>> function login() {
>> if ($this->Auth->user())
>> {
>> $this->Session->SetFlash(__('Successfully logged in as '.
>> $auth_user['User']['full_name'],true));
>> $this->redirect($this->Auth->redirect());
>> }
>> }
>>
>> On Jan 5, 3:22 am, "Novice Programmer" <[email protected]>
>> wrote:
>> > Hello All,
>> >
>> > I am trying to set up auth redirect. i.e the user will be redirected to
>> > login screen if he accesses a page which can't be accessed without the
>> > username/password. After the user authenticates, I try to redirect the
>> user
>> > back to the page which he was accessing using
>> > $this->redirect($this->Auth->referer());
>> >
>> > Though the user is redirected to the proper page but my custom Routes
>> break
>> > when such a redirection happens. Here is my auth setup.
>> >
>> > $this->Auth->actionPath = null;
>> > $this->Auth->loginAction = array('controller' => 'invites',
>> > 'action' => 'index');
>> > $this->Auth->loginRedirect = array('controller' =>
>> 'entities',
>> > 'action' => 'index');
>> > $this->Auth->logoutRedirect = null;
>> >
>> > Please help on how to go about fixing this.
>> > --
>> > Thanks & Regards,
>> > Novice.
>> >>
>>
>
>
> --
> Thanks & Regards,
> Novice.
>
--
Thanks & Regards,
Novice.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---