Skip to content

Commit 87a86b9

Browse files
committed
Fix - Auth redirect would fail in subfolder scenario
1 parent 2a67499 commit 87a86b9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

protected/application/admin/controllers/AuthController.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,14 @@ public function loginAction()
109109
// Send the cookie with the authentication data
110110
$cookie = new Stuffpress_Cookie($user->id);
111111
$cookie->set($remember);
112-
112+
113+
$config = Zend_Registry::get('configuration');
114+
$domain = trim($config->web->host, " /");
115+
$path = trim($config->web->path, " /");
116+
117+
113118
// If we have a special target
114-
if ($values['target'] == 'user_page') {
115-
$config = Zend_Registry::get('configuration');
116-
$domain = trim($config->web->host, " /");
117-
$path = trim($config->web->path, " /");
118-
119+
if ($values['target'] == 'user_page') {
119120
// If single user, we go back to the host
120121
if (isset($config->app->user)) {
121122
$url = "http://$domain/$path";
@@ -126,7 +127,8 @@ public function loginAction()
126127
return $this->_redirect($url);
127128
}
128129
else if ($values['target']) {
129-
return $this->_redirect($values['target']);
130+
$target = trim($values['target'], " /");
131+
return $this->_redirect("http://$domain/$target");
130132
}
131133

132134
// Otherwise we go back to the home page

0 commit comments

Comments
 (0)