#5893: Can't redirect to a custom page by passing right arguments to
Auth->redirect method
---------------------------+------------------------------------------------
Reporter: macroangle | Type: Bug
Status: new | Priority: Medium
Milestone: 1.2.x.x | Component: General
Version: RC2 | Severity: Normal
Keywords: | Php_version: n/a
Cake_version: |
---------------------------+------------------------------------------------
== What I did ==
Implemented the Auth component to redirect after login as:
{{{
$this->Auth->loginRedirect = array('controller'=> 'home', 'action' =>
'index');
}}}
After login, if the user is an admin user, i had to redirect to admin page
which i achieved by redirecting through Auth after login as
{{{
function login() {
/* After authentication */
if($this->Auth->user('type')) {
$this->redirect($this->Auth->redirect(array('controller' =>
'admin')));
}
}
}}}
== What I expected ==
If the user is of admin type, then he should get redirected to admin
controller page
== What happened ==
Instead of redirecting to admin page, i got an error ' Error: The action
1 is not defined in controller UsersController'
== What is happening ==
When i pass the array of redirection options, in Auth.php at link 641 for
redirect function we have
{{{
if (!is_null($url)) {
return $this->Session->write('Auth.redirect', $url);
}
}}}
This function should return an array of redirection parameters, instead
after it runts the line to write into the session, the returned array is
has one item with value as 'true' saying it was successful in writing the
values into session
== Possible fix ==
The above lines should be replaced as
{{{
if (!is_null($url)) {
$this->Session->write('Auth.redirect', $url);
return $url;
}
}}}
--
Ticket URL: <https://trac.cakephp.org/ticket/5893>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets 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/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---