I am Using Liferay 6.1CE.
I can able to set my default landing page to a site in control panel.
But in my portal 2 sites are there,two users are there.
For eg: userA is a member of siteA,simularly UserB member of siteB.
How can i redirect the users to their site after login.
What can i do?
I guess 2 sites you mean two communities. Anyway you need to create post login action where you'll check your conditions and redirect where needed.
You can create the Liferay hook for your custom login post action. Please have a look at :
custom action using hook
on how to create the hook.
In the hook, you can identify the looged in user based on your search criteria and redirect to the relevant community.
Related
My company has just obtained Kentico for some new applications. These applications will be going into production in about 2 weeks, so we are still fairly new with this. What we have are three ASP.NET MVC applications/sites that format and present content that is stored in Kentico. Additionally, we have specific users who will log into the Kentico9/Admin site to manage the content displayed by the MVC apps.
From a corporate standpoint, we also have Siteminder SSO enabled. When a user navigates to our Kentico9/Admin site, they are first authenticated by our corporate Siteminder SSO form using their corporate user id. When they are successfully authenticated, Siteminder redirects the user to the Kentico9/Admin site they originally requested and the user is presented with the standard Kentico login form. If the user has already logged in through Siteminder during another session, they only get presented with the Kentico login form. Otherwise, if this is their first time logging in, the user is required to login twice (once through Siteminder and again through Kentico).
What I want to do is bypass the standard Kentico login form and use the Siteminder information to Authorize the user to log them into the Kentico admin site. Siteminder adds the username and some other information to the HTTP request headers. Using C#, I can retrieve their corporate user id using the following: System.Web.HttpContext.Current.Request.Headers.Get("SM_USERID").
So, in a nutshell, I want to override Kentico's standard login form and write some code that will get the user id from the HTTP request header and authorize the user by looking up their userid in Kentico. If the user id is not found or is not active, present the user with the standard Kentico login form. Otherwise, if the user is a valid and active user, pull their user record and allow them to access Kentico.
I have found some tidbits of information and given enough time, I may be able to figure something out, but I am hoping someone has done something similar and can speed up my process. Any ideas on what I can do? I will also entertain anything that might have tighter integration with Siteminder, although it doesn't seem Kentico can handle Siteminder out of the box, but I am not sure about that.
Sounds like you might be able to create a custom webpart which you will place on a page and simply have Siteminder redirect the user to the page with that webpart on it and look for those header values on page load. If it finds them, perform your actions within Kentico to look that user up and authenticate them in Kentico as needed. If there are no header values or it can't find the Kentico info, simply send them to the regular login page.
You could also create a global event handler but that would require someone to click a button or such on your site after they have entered credentials.
i have developed a portal using Liferay.I have two kind of users, guest user and Admin user. The login should be possible by the Admin only. The guest user should not be able to login , or even see the sign in button. How do i achieve this? through different url's?
You might consider the following approach:
Remove the login portlet from the theme template. (portal-normal.vm)
Create a hidden page on your Guest group. On this page you place only the login portlet. So only the people who know the direct URL are able to login. AFAIK there is no other way to achieve this, as you don't know if someone is an Admin before he entered his credentials ;)
[EDIT]
To remove the login portlet from the template you have to do the following steps:
A) If you don't have a custom theme
- Create a new Theme
- Parent of your new theme is classic
- Place portal_normal.vm in /docroot/_diffs/templates
- Remove these lines:
#if (!$is_signed_in)
<a data-redirect="$is_login_redirect_required" href="$sign_in_url" id="sign-in" rel="nofollow">$sign_in_text</a>
#end
That should remove the login link.
- Compile and deploy your theme
- Assign the theme to the portal as default theme. Assign the theme to your guest group Site.
Now you only have to create your hidden page and place the login portlet on it.
[/EDIT]
You can also consider an alternative approach if you know sth more about the admin users - e.g. their IP address / addresses, then you could modify the contents of a page in a similar manner as stated by Gevatterjan, but then you check not for the signed-in users, but the ones with specfic IPs.
I have 4 different organization and some users are associated to it. I have separate site for each organization. my requirement is If I am user of organization A , On login I should be able to redirect to my organization site.
eg: localhost:8080/web/org-A/home
How can I achieve this requirement. As per my knowledge I need to create post login hook by which user will get redirected to its own site.
I would like to know if any configuration in poral-ext.property is available by which user can redirect to his own site automatically after login.
User A ----> has "XYZ" role and has "ABC" as home site User B ---->
has "PQR" role and has "DEF" as home site
Whenever user A logs in I need to redirect him to site "ABC" rather than default guest site.
Whenever user B logs in I need to redirect him to site "DEF" rather than default guest site.
Through hook I have achieved this
hook property:
login.events.post=com.mytest.portal.events.MyLoginPostAction
And then in MyLoginPostAction I have checked the user role and then redirected him to corresponding site.
Now, say user A has subscribed to the blog on any of the site. He receives an emaial containing link to that Blog.
User A is logged out and then he tries to reach that Blog with direct link. Since user A is not logged in, he is redirected to login page.
On log in he is redirected to site "ABC" rather than going to that Blog. This is due to I am redirecting User to home site.
So how can I achieve this scenarioes i.e when user try to access that Blog page when not logged in then on log in he should go to that blog page and when user just try to log in to portal then he should redirect to home site.
You can get lastpath object in your action class by
request.getSession().getAttribute("LAST_PATH")
And based on path value from lastpath object, you can determine where to redirect.
By necessary login by direct link, Liferay set the forward path as url parameter. May be you can read the redirect parameter from request and decide to forward to specific page or not.
I got a requirement to dispatch users to different landing page per their user group immediately after login, it seems SharePoint does not supply an API regarding login event, so I implemented a web part and added it to homepage to handle the dispatch, this would work perfect util users logout and login, SharePoint has a history where users were in their last login, to be precise, a parameter in url named Source to handle the redirect after login, so users will on longer go to their customized landing page.
I searched a lot and found someone doing this with custom login from, this is way too complex and client won't let me touch their Active Directory.
I'm at my wit's end to know what to do, can someone shed some light on this, any help or advise is deeply appreciated
Why don't you use a delegate control in the masterpage, that checks a value in the session if you entered through the landing page. On the landing page you add the value to the session specifying that this user has entered through the landing page.