Skip to content

Commit 7b86ddc

Browse files
committed
change the way it handle the redirect
1 parent a107f8a commit 7b86ddc

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

modules/mod_auth0/tmpl/default.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
if ($params->get('show-login-form') == 1) {
1717

18+
$redirectUrl = $params->get('redirect-url');
1819
$showAsModal = ($params->get('show-as-modal') == 1);
1920
$bigSocialButtons = ($params->get('big-social-button') == 1);
2021
$lockURL = $params->get('lock-url');
@@ -55,6 +56,10 @@
5556
$lockOptions['dict'] = $dict;
5657
}
5758

59+
if (!empty($redirectUrl)) {
60+
$lockOptions['authParams']['state'] = base64_encode($redirectUrl);
61+
}
62+
5863
if (!empty($iconURL)) {
5964
$lockOptions['icon'] = $iconURL;
6065
}
@@ -67,16 +72,16 @@
6772
$lockOptionsJson = json_encode($lockOptions);
6873

6974
$javascript = "
70-
var lock;
71-
jQuery( document ).ready(function(){
72-
lock = new Auth0Lock('$clientid', '$domain');
73-
});
75+
var lock;
76+
jQuery( document ).ready(function(){
77+
lock = new Auth0Lock('$clientid', '$domain');
78+
});
7479
75-
function a0ShowLock() {
76-
lock.show($lockOptionsJson);
77-
}
80+
function a0ShowLock() {
81+
lock.show($lockOptionsJson);
82+
}
7883
79-
";
84+
";
8085

8186
$auth0js = '<script src="' . $lockURL . '"></script>';
8287

@@ -86,11 +91,11 @@ function a0ShowLock() {
8691
} else {
8792
$javascript .= "
8893
89-
jQuery( document ).ready(function(){
90-
a0ShowLock();
91-
});
94+
jQuery( document ).ready(function(){
95+
a0ShowLock();
96+
});
9297
93-
";
98+
";
9499
echo '<div id="auth0-login-form"></div>';
95100
}
96101

site/controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function display($cachable = false, $urlparams = false)
3131
}
3232

3333
private function getReturn($key, $type) {
34-
$return = base64_decode($this->app->input->post->get($key, '', $type));
34+
$return = base64_decode($this->app->input->get->get($key, '', $type));
3535
if (!JUri::isInternal($return))
3636
{
3737
$return = '';
@@ -67,7 +67,7 @@ function AuthJUser()
6767

6868
if (empty($return))
6969
{
70-
$return = $mod_params->get('redirect-url', 'index.php?option=com_users&view=profile');
70+
$return = 'index.php?option=com_users&view=profile';
7171
}
7272

7373
// Set the return URL in the user state to allow modification by plugins

0 commit comments

Comments
 (0)