-
1. Re: prevent the login page after logged in
swd847 Feb 15, 2009 10:20 PM (in response to thiagu.m)Vote for JBSEAM-3507.
For now though you can do this:
<page action="#{"".toString()}" view-id="/login.xhtml"> <navigation from-action="#{"".toString()}"> <rule if="#{identity.loggedIn}"> <redirect view-id="/myOtherPage.xhtml" /> </rule> </navigation> </page>
-
2. Re: prevent the login page after logged in
thiagu.m Feb 16, 2009 5:51 PM (in response to thiagu.m)after put this code in my pages.xml , i have same problem.
if i put the following code into my login.page.xml it will fix the issue Partially.
`
<action execute='#{"".toString()}' />
<navigation from-action='#{"".toString()}'>
<rule if="#{identity.loggedIn}">
<redirect view-id="/home.xhtml">
<!--message>You are already logged in!</message-->
</redirect>
</rule>
</navigation>
`
after successfully logged in if try "http://localhost:8008/myproject/login.seam" url in browser addess bar , it will redirect me to home page.
otherwise if i use the browser back button after sucessfully loggedin , it won't redirect me to home page.
any help .
by
thiagu.m -
3. Re: prevent the login page after logged in
swd847 Feb 16, 2009 10:37 PM (in response to thiagu.m)The browesr is caching the page, try something like this in pages.xml:
<page expires="0" view-id="/login.xhtml"> <header name="Cache-Control" value="max-age=0" /> </page>
-
4. Re: prevent the login page after logged in
thiagu.m Feb 17, 2009 7:41 PM (in response to thiagu.m)i cant clear the browser cache after put he above code into my pages.xml file .
this is what i am try in my project to reproduct this issue.
first i create a new project by using seam 2.1.1.GA seam gen.
then i edit the index.html from view folder and set URL="login.seam".
then i add the following navigation roule in my login.page.xml file
<action execute='#{"".toString()}' />
<navigation from-action='#{"".toString()}'>
<rule if="#{identity.loggedIn}">
<redirect view-id="/home.xhtml">
<message>You are already logged in!</message>
</redirect>
</rule>
</navigation>
then i add the following code in my pages.xml file
<page expires="0" view-id="/login.xhtml">
<header name="Cache-Control" value="max-age=0" />
</page>
then i build build the project and startup my server.
then i try to access my project it will load the login.seam as a first page.
then i logged in by using admin user name.
then i hit the browser back button , it will redirect me to login.seam page.
i need to redirect home page with face message.
any help
by
thiagu.m -
5. Re: prevent the login page after logged in
swd847 Feb 18, 2009 12:01 AM (in response to thiagu.m)There are lots of other headers and html meta tags that control caching, have a google and read up on them (its really not my area, I think you probably want the no-cache header rather that max-age=0, sorry). To verify that this is a caching issue clear the browser cache manually before hitting the back button and see what happens.
Stuart
-
6. Re: prevent the login page after logged in
thiagu.m Feb 18, 2009 4:34 PM (in response to thiagu.m)thank you for reply.
now it is working correctly.this is what i did .
first i put those navigation rules.
then i build the project and startup the server.
after successfully logged in, i clear the browser cache , then i hit the browser back button it wont allow me to reach login page again. it will shows the home page with alert message.
now i am search how to clear the browser cache.
if any one knows help me ..by
thiagu.m -
7. Re: prevent the login page after logged in
swd847 Feb 18, 2009 11:09 PM (in response to thiagu.m)You cannot clear the browser cache, what you have to do is instruct the browser not to cache the page, have a look here for some more info. I think
<page view-id="/login.xhtml"> <header name="Cache-Control" value="no-cache" /> </page>
is probably what you are after.