Topic-icon Redirect on logout from registered view access page

Active Subscriptions:

None
Registered and above users have access to pages not visible to 'guests'. I have setup that on log-out it goes to 'same page'. This works excellently except, as would be expected, when the page being examined is restricted to being viewed by registered or above only. In that circumstance it goes to the default Joomla log-in page. It would be much better if one could still define another default page. Going to the Home page would be a reasonable automatic alternate. Going to the default login page is the worst possible state as it comes up with the message about you need to login first!!
Colin
The topic has been locked.
Support Specialist
10 years 4 months ago #39453 by alzander
There is code in the SCLogin module to do exactly what you're looking to do. I'm not sure why it's not working for you. Basically, for the logout link, whether you've configured it for Same Page or a specific URL, the module will always check to see if the redirection is going to be for a non-public page. In that case, the redirection is automatically changed to the home page menu item URL.

Looking at our code, we do actually have the "Public" access level hard-coded to '1'. If you've changed your access levels and the 'Public' or 'Guest' levels are not the default Joomla standards, that could be why. Can you check the Access Levels in your Joomla configuration area and let me know what the ID for "Public" is? If not 1, that'd be the problem.

Let me know, and we'll gladly help you get to the bottom of things.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 4 months ago #39466 by colinM
Hi
I have checked on id code for public and indeed it is the standard value of 1. In all cases where it is public then all is very good.
I have two cases, both of which fail, as below.
(1) Log out whilst viewing a registered atrtcle, called from a menu item which has a view access calledd 'standard-edit' with id = 7. Also tried this with calling menu as public but gave same result.
(2) Log out whilst viewing a component called from a menu which had view access edit-standard.
I investigated this case a bit more deeply and was led to routine SCLibraryUtilities::isMenuRegistered called from function getLinkFromMenuItem, both in sc_helper.php. As you said isMenuRegistered tests against the fixed value "1" and returns true if != "1", indicating menu has restricted viewing access that will disappear on logging out. getLinkFromMenuItem identifies if called from a regular "registered or above" menu item. It then sets up $link with 'index.php' Think this does not always resolve to the home address. I will look further.
Colin
The topic has been locked.
Support Specialist
10 years 4 months ago #39477 by alzander

(1) Log out whilst viewing a registered atrtcle, called from a menu item which has a view access calledd 'standard-edit' with id = 7. Also tried this with calling menu as public but gave same result.

I'm not sure what you mean by the last part. If you called with a menu item that was public, what went wrong in that case?

For #2, I'm honestly not even sure where/if the getLinkFromMenuItem is called anymore. That's actually some older code that's likely to be removed soon, since it uses the SourceCoast library, which is only available when JFBConnect is installed. If you see that being called from somewhere, let me know. I may have just missed it.

The main code to look at is the getLoginRedirect() function in the helper.php file. There's actually some comments in that code as to what's occurring, and it's pretty straightforward. I'd look at that, if you're going to dive into the code anywhere.

We've definitely tested that code a bit, but it's always possible we missed something!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 4 months ago #39579 by colinM
Embarrassment! I was using an older version - stupid, I did not check as is my usual practice. Can we get rid of this chain?

Just for the record it does go to the home page if logging out whilst viewing a 'privileged page'.

Have found Captcha stuff is not displaying if asking for re-send/renew of login name or p/w but I need to check (double check!!) it is not me before raising query. And search forum of course.

Again humble apologies
Colin
The topic has been locked.
Support Specialist
10 years 4 months ago #39595 by alzander
Colin,
No worries for the questions. Obviously, at one point, that redirection was broken.. and I'm glad we've fixed it properly. I remember the process for developing that redirection code as there were a lot of different scenarios to be prepared for... thanks for testing it more and verifying that it's (now) working as expected!

Regarding captcha, you might be bitten by a bug in Joomla itself. If captcha's are working on some pages, but not others, this won't be it... but if they're not working anywhere, I'd recommend checking out the post below:
www.ostraining.com/blog/joomla/broken-captcha/

I hope that all helps, but should you need anything else, just let me know!

Finally, if you haven't already, please consider leaving a rating and review for SCLogin, or our support, on the Joomla Extension Directory. It certainly isn't required, but is very appreciated:
extensions.joomla.org/extensions/access-...authentication/24054

Thanks,
Alex
The topic has been locked.