Skip to content

Fix links to restricted pages#22445

Closed
csthomas wants to merge 1 commit intojoomla:stagingfrom
csthomas:fix_restricted_link
Closed

Fix links to restricted pages#22445
csthomas wants to merge 1 commit intojoomla:stagingfrom
csthomas:fix_restricted_link

Conversation

@csthomas
Copy link
Contributor

@csthomas csthomas commented Oct 1, 2018

Summary of Changes

Generate a correct link to the restricted page, even you have no access yet.
This PR prevents duplicate links when you are logged in or not.

Testing Instructions

  1. Create a two menu items. One for Login Form and the other for User Profile.
    screenshot_20181001_225658

  2. Enable Modern Routing for com_users

  3. Go to login form /login and log in.

  4. After logged in you should be redirected to /profile

  5. Change access level from Public to Registered for User Profile menu item (/profile)

Note: to clear old return URL (if you tested patched version first, after logged in, you should go to the other page (ex. home page) and logout. Next, back to the login page again). If this does not help then clear cookies.

Actual result

After logout and log in again you are redirected to /login?view=profile. If not then see at the note above.

Expected result

After logout and log in again you should be redirected to /profile.

Documentation Changes Required

No

@csthomas
Copy link
Contributor Author

csthomas commented Oct 2, 2018

This PR has not passed unit tests.

The solution could be:

			if (get_class($this->router->menu) === 'Joomla\CMS\Menu\SiteMenu')
			{
				$attributes[] = 'access';
				$values[]     = null;
			}

but it does not look good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants