Skip to content

Commit a107f8a

Browse files
committed
added default redirection url as a module config
1 parent 9039920 commit a107f8a

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

modules/mod_auth0/languages/en-GB.mod_auth0.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ MOD_AUTH0_BIG_SOCIAL_BUTTONS="Show big social buttons"
1919
MOD_AUTH0_BIG_SOCIAL_BUTTONS_DESC="If enabled will show big social buttons"
2020
MOD_AUTH0_FORM_TITLE="Form Title"
2121
MOD_AUTH0_FORM_TITLE_DESC="This is the title for the login widget"
22+
MOD_AUTH0_REDIRECT_URL="Redirect Url"
23+
MOD_AUTH0_REDIRECT_URL_DESC="Url where the user will be redirected after authentication"
2224
MOD_AUTH0_DICT="Translation"
2325
MOD_AUTH0_DICT_DESC="This is the widget's dict param.<a target="_blank" href="https://github.com/auth0/lock/wiki/Auth0Lock-customization#dict-stringobject">More info</a>"
2426
MOD_AUTH0_ICON_URL="Icon URL"

modules/mod_auth0/mod_auth0.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@
4848
<field name="big-social-button" type="checkbox" default="0" label="MOD_AUTH0_BIG_SOCIAL_BUTTONS"
4949
description="MOD_AUTH0_BIG_SOCIAL_BUTTONS_DESC"/>
5050

51+
<field name="redirect-url" type="text" default="" label="MOD_AUTH0_REDIRECT_URL"
52+
description="MOD_AUTH0_REDIRECT_URL_DESC"/>
53+
5154

5255
</fieldset>
5356

5457
<fieldset name="advanced" label="MOD_AUTH0_ADVANCED_SETTINGS">
5558

56-
<field name="lock-url" type="text" default="//cdn.auth0.com/js/lock-7.min.js" label="MOD_AUTH0_LOCK_URL"
59+
<field name="lock-url" type="text" default="//cdn.auth0.com/js/lock-8.2.2.min.js" label="MOD_AUTH0_LOCK_URL"
5760
description="MOD_AUTH0_LOCK_URL_DESC"/>
5861
<field name="dict" type="textarea" default="" label="MOD_AUTH0_DICT" description="MOD_AUTH0_DICT_DESC"/>
5962

site/controller.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
defined('_JEXEC') or die('Restricted access');
1111

1212
jimport('joomla.application.component.controller');
13+
jimport( 'joomla.application.module.helper' );
1314

1415
class auth0Controller extends JControllerLegacy
1516
{
@@ -51,6 +52,11 @@ function AuthJUser()
5152

5253
$this->app = JFactory::getApplication('site');
5354

55+
$com_params = JComponentHelper::getParams('com_auth0');
56+
$module = JModuleHelper::getModule('mod_auth0');
57+
58+
$mod_params = new JRegistry();
59+
$mod_params->loadString($module->params);
5460

5561
$return = $this->getReturn('state', 'RAW');
5662

@@ -61,17 +67,15 @@ function AuthJUser()
6167

6268
if (empty($return))
6369
{
64-
$return = 'index.php?option=com_users&view=profile';
70+
$return = $mod_params->get('redirect-url', 'index.php?option=com_users&view=profile');
6571
}
6672

6773
// Set the return URL in the user state to allow modification by plugins
6874
$this->app->setUserState('users.login.form.return', $return);
6975

70-
$params = JComponentHelper::getParams('com_auth0');
71-
72-
$clientid = $params->get('clientid');
73-
$clientsecret = $params->get('clientsecret');
74-
$domain = 'https://' . $params->get('domain');
76+
$clientid = $com_params->get('clientid');
77+
$clientsecret = $com_params->get('clientsecret');
78+
$domain = 'https://' . $com_params->get('domain');
7579

7680
$code = $this->app->input->getVar('code');
7781

0 commit comments

Comments
 (0)