Joomla 3: Redirect to same page after successful loginPublished: Tuesday, 21 July 2020 03:18 Written by Ogri Hits: 9898
On the site, authorization occurs through the mod_login module. In the module settings, the option Login Redirection Page is set to Default. After entering the correct username and password, however, Joomla redirects to a variety of places, depending on which extension owns the currently active page. Sometimes it redirects to the site root, other time to a category blog. It's inconvenient. When a user exits (redirection option is also Default), the page does not change, everything is good.
I had to dig around and find a place in the code where the redirect is implemented. It was found not in the authorization module, but in the com_userscomponent. Namely, in the file components\com_users\controllers\user.php. And a small change in its code resolved the issue.
The login() function has been modified. Here is the original one:
public function login() { $this->checkToken('post'); ...................... $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false)); }
And now look at the changed one.
public function login() { $this->checkToken('post'); ...................... //comment out default redirect // $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false)); //redirect to the same page $return = $input->get('return', '', 'BASE64'); $return = base64_decode($return); $app->redirect(JRoute::_($return, false)); }
As you can see, the last line is commented out and three new lines have been added instead. The logic is taken from the next function, logout().
It is unclear what prevents the developers from fixing this discrepancy. Perhaps it, like many others, will be fixed in Joomla 4.
Latest News
-
Tuesday, 21 July 2020 03:18
Joomla 3: Redirect to same page after successful login -
Saturday, 30 December 2017 16:11
Joomla: how to add your own language constants or override existing ones -
Thursday, 30 November 2017 23:27
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
Saturday, 25 June 2016 15:33
Unified filtering of mod_jcomments_latest module's output -
Thursday, 17 September 2015 16:23
Post an illustrated Joomla-site article on Facebook using OG-tags
Articles Most Read
-
142448
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments -
74151
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments -
44126
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-2. Template, editor, and other extensions -
38852
Editing animated GIF-images in Photoshop CS3 -
36286
Migrating from Joomla 1.5 to Joomla 2.5. Part 1. Transferring content
Login
Guest Column
Recent comments
-
Joomla: Integrate reCAPTCHA v2 (NO CAPTCHA) into JComments
-
Maryjo 08.06.2023 21:23
-
bacot138 08.06.2023 20:04
Valuable information. Fortunate me I discovered your website by chance, and I'm stunned why this twist ...
-
Ian Dombroski 08.06.2023 18:20
This is actually a fabulous post. Many thanks for sharing it!
-
รับทำเว็บพนันออนไลน์ 08.06.2023 16:13
I will right away clutch your rss feed as I can not in finding your e-mail subscription hyperlink or ...
-
teatro etec 08.06.2023 16:12
Este Texto me convenceu de uma coisa, eu seriamente sinto que este blog precisa de muita atenção por ...
-
диплом института 15.05.2021 03:19
Fantastic items from you, man. I've be aware your stuff prior to and you're simply extremely magnificent.
-
PG SLOT 13.01.2021 09:21
Hey! I could have sworn I've been to this site before but after browsing through some of the post ...
-
-
Migrating from Joomla 1.5 to Joomla 2.5. Epilogue
-
Dewitt 11.02.2021 06:17
HELP. I can't write a comment without the page freezing.
-
-
Migrating from Joomla 1.5 to Joomla 2.5. Part 2-1. Transferring jDownloads and jComments
-
Francine 14.12.2020 08:49
I cant stomach this person so sorry x
-
-
Unified filtering of mod_jcomments_latest module's output
-
Фильмы 2022 онлайн 03.12.2021 21:37
This web site definitely has all of the info I wanted about this subject and didn't know who to ask.
-
Read more...