Issue
- Need to have a custom login page instead of a default sign-in portlet when a user tries to access a private page without being logged in.
- The private and public pages are not having Guest user’s VIEW permission.
Environment
- Liferay DXP 7.4
Resolution
- The following are the steps that would help to achieve the requirement here :
- Set the following properties in the
portal-ext.propertiesfile: "auth.login.site.url=/sign-in", "auth.login.url=/sign-in" - Started the portal.
- Removed the release feature flag of the private pages at “Control Panel > System Settings > OTHER > Release Feature Flags“ with the “Disabled Features” dropdown to “Disable Private Pages”.
- Changed the default site’s
/guest“Friendly URL” (at “Menu > Configuration > Site Settings > Site Configuration > Site URL”) to/abcas per the use case. - Created a
/sign-inpublic page with a Sign-in widget on that. - Created a
/restrictedpublic page by removing the Guest user’s VIEW permission. - Created a
/private-homeprivate page. - Also, enable the 'Prompt Enabled' option here [User-is-redirected-to-the-404-page-instead-of-the-login-page-when-the-session-expires]
- Set the following properties in the
- Now, to test the above steps for this use case:
-
Hit both the pages created at the 6th and the 7th steps by the Guest user should lead to the
/sign-inpublic page.e.g., the URL pattern would something be like this:
Restricted public page: localhost:8080/web/abc/restricted-public-page
Private page: localhost:8080/group/abc/private-home-page
-
Additional Information