[opencms-dev] Redirecting to Index page if the user logs out in a protected page
Paul-Inge Flakstad
flakstad at npolar.no
Tue Mar 30 22:10:22 CEST 2010
Hi Pujan,
You are correct, determining if the page is public or not public has to be done before redirecting (or not redirecting). You'll need to do this check programmatically, but it shouldn't be too hard.
If you're using OpenCms' permission system or properties for access control, you can use OpenCms' API. A good start would be to check out CmsObject#getPermissions(String).
If you're using something other than OpenCms for permissions, you'll need to figure out another solution. :)
HTH,
Paul
________________________________________
Fra: opencms-dev-bounces at opencms.org [opencms-dev-bounces at opencms.org] på vegne av Pujan Kafle [kafle.pujan at jimmy.harvard.edu]
Sendt: 30. mars 2010 17:09
Til: The OpenCms mailing list
Emne: Re: [opencms-dev] Redirecting to Index page if the user logs out in a protected page
Hi Paul,
Thank you for your reply. But there are some pages in the website as
well which are accessible to all. In such cases, when the user logs out,
user should stay in the same page(the login area would now show username
and password textboxes).
So, depending on the permissions of the page in which the user logs out,
the user would be redirected to the index page using the way you
suggested or no redirection would occur if the page is public.
Any suggestions would be highly appreciated.
Thanks,
Pujan
Paul-Inge Flakstad wrote:
> Hi Pujan
>
> Sounds to me like all you need to do is redirect (response.sendRedirect("/your/site/indexpage.html");) after logout procedures have completed?
>
> Paul
>
>> -----Original Message-----
>> From: opencms-dev-bounces at opencms.org
>> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Pujan Kafle
>> Sent: 30. mars 2010 16:50
>> To: The OpenCms mailing list
>> Subject: [opencms-dev] Redirecting to Index page if the user
>> logs out in a protected page
>>
>> Hello everyone,
>>
>> I have included a small login form on my main template. All the web
>> pages in my site, including the protected ones use the main template.
>> However, when I log out from a protected web page, it
>> immediately shows
>> me a HTTP Authentication required popup, which asks for OpenCms login
>> credentials. If I click cancel, I am redirected to Tomcat's
>> HTTP Status
>> 401- Error Page.
>>
>> I am wondering, in such scenarios, is it possible to redirect
>> the user
>> to the index page of the site, thus avoiding that
>> Authentication pop-up
>> and Tomcat's error page.
>>
>> Your suggestions would be highly appreciated.
>>
>> Thanks,
>> Pujan
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list,
>> please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list