Question

I am building a basic login page using the existing sign-in portlet.

I just want to have a functionality that when a user access the website, right now localhost:8080, the sign-in portlet should pop up!

Is this doable? If so, Can someone please hint me how this can be done?


This is how the default page looks like right now:

Default page

To log in, I have to explicitely click on the "sign-in" blue button and then it pops out a modal sign in portlet.

pop-up sign-in portlet

But what I am trying to do here is:

  1. Whenever a user clicks on the default url, it should immediately ask the user to login rather than showing a blank page with a sign-in button (something like the output image)
  2. Or even a modal sign-in box (Whatever is easy to customize.) and
  3. Whenever a user hits any other url for eg. localhost:8080/web/project1/home and if the user is not signed in, it should force him to sign in first.

home page with sign-in portlet

Was it helpful?

Solution

Two possibilities out of the box:

  • place nothing but the sign in portlet on the homepage, appearing at that location (typically /web/guest/home)
  • protect your default page to be not visible to the guest user (this will automatically forward to the sign-in portlet) - see the "Permissions" button on the "Manage Pages" interface

There are more, but these seem to be the first and most obvious ones. Let me know if one of them works for you or what the reason for your request is

OTHER TIPS

From what I understand, you want the Login Portlet to popup as a modal window/lightbox on the current page (i.e. without leaving the page). AFAIK, to achieve this, you'll have to develop all your portlets to use AJAX to create links that point protected resources. So when you get an unauthenticated request, you can stay on the same page and show login dialog.

This is high-level approach. You'll need to 1) embed the Login portlet in your theme and 2) put the below javascript functionality in Theme:

  • callback function - to handle response for unauthenticated request,
  • to render modal/lightbox

You might face surprises while implementing this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top