I have a link on a page that requires user login to access. I've setup Spring Security so that the user is redirected to the login page (if not logged in), and after successful login is redirected to the required screen.
All well and good. But the user wants the new screen to show in a new window, so I can add target="_blank" on the link in the original jsp page, which will cause both the login and new screen to appear in the new window.
However, now the user wants the Login screen (if user not logged in) to show in the original window, and the new screen to show in a new window. This can, of course, be done with javascript, but is there any way for Spring to redirect the view to a new window?
Whether a page response from a server opens in a new browser window, or if a redirect opens in a new window is ultimately determined by client side behavior.
Even if such functionality existed in Spring, it would ultimately be an abstraction of Javascript.
No, it's impossible. The server-side doesn't know anything about the browser windows, and is unable to control them. You may only handle this at client side.
Related
I am having difficulty with logging in and the functionality of the back and forward buttons associated with a user who is logged in. When I log into the application from the login page I am directed to a page (lets call it logged_home). If I press the back button I am returned to the login page. If I then press forward I am redirected to the "logged_home" page. The desired outcome when pressing the forward button at this point would be that the logged session is destroyed and if the person presses the forward button it remains or redirects back to itself i.e. login.
I have tried a number of approaches including clearing cache and destroying the session but havent found a workable approach as yet. In detail I have tried to instigate a session destroy every time the login page is loaded but it doesnt seem to work as intended. Any guidance would be appreciated.
Am using struts2 to create login and logout functionality, when user login i will create the session for him,by using interceptor i will filter all users if they are in session or not if the session not created i will redirect the page to login........my problem is once i done logout that will redirect to the login page but when user click browser back button the page will get refreshed and again that will login ,,,,,,could anybody help me out from this problem
Thanks in advance
When you click "<-" button on browser the browser renders the page from its cache. So server does not know if you have click back button. In your case when user clicks back button, page is loaded from cache but it does not mean that session is again created for that user as logged in. When user will click on any authorized link on that page, your server side code will check that user has no valid session and login page will be returned.
Solution: However if you do not want user to get cached page then you can load a script say checkLogin.js for every page in your site. This script should be executed on load event of the pages. When user logs out, set a variable in cookie indicating that user has logged out. When user clicks back button then that script will be executed. That script will check, using the mentioned cookie variable, if user has logged out. If user had logged out then redirect to login page using javascript.
To avoid that refreshing i have redirect my page to menu after loginsuccess not forward i have escaped from that ghost problem
use like this in ur struts.xml
<result name= success" type="redirect">Menu.jsp</result>
thanks for all
I m trying to make one test app in windows phone 7.1 And I am using webBrowser control in my app and giving url of external website. User input login details in that form and press submit button. How I Can know the user is logged in.
Thanks,
You can track the URL the user is being redirected to, using the WebBrowser.Navigating event. Check the NavigatingEventArgs.Uri property.
Then you just need to work out the page that the login page redirects to, and if the user is navigating to that then they have successfully logged in.
I am having a session issue in codeigniter 2.0. The reason I think is it caching the page. Here is my problem.
I created a page and to access this page a user login is required. The login works fine. When I logout then I again redirected to login page and thats perfect. But if I click Back button of my browser then it again take me to that protected page. Technically this page is not accessible now because I have already logged out. If I put the link of that protected page in browser then it ask me to log in but after logout the browser back button is having the issue.
Can anyone please guide me with this.
Thanks
That's normal browser caching behavior. One of the way to fix that is to make sure that wherever users go from the cached page, their session will be checked, and if they've logged out in the mean time, they'll be redirected to the login screen, so no harm can be possibly done.
i have a problem with a WP7 app. I want that a user can login into the application, doing some stuff and logout.
Now, then a new user get the phone, it should not be possible to get into the session of the old user (by simply pressing back until the user see the intern data of the previous user who was logged in).
how to make this?
The best thing would be, that when a user press the back button, it will be forwared to the first page of the app. the problem then is, that there will be a loop and the app will not pass the certification because it will not be possible to exit it.
Here is an overview:
loginPage (no return just exiting the app) -> internPage (possibility to logout and return to loginPage)
You can clear the back stack using NavigationService.RemoveBackEntry:
while (this.NavigationService.BackStack.Any())
{
this.NavigationService.RemoveBackEntry();
}
Put this in the OnNavigatedTo of your LoginPage, so pressing back on this page will exit the application. If the LoginPage is the first page the user sees when launching the app (and therefore is the application main page), it should pass certification.
try the nonlinearnavigationservice that way back will unwind your history properly an you back out of the mainpage it will exit your app correctly.
http://create.msdn.com/en-US/education/catalog/article/nln-serv-wp7
why not have the mainpage show the icons for the different users, and a click onto the user would ask for their password?
You cannot change the navigation flow of your application so that the back-button takes you to the first page. This will result in you failing the marketplace certification.
What you could do is handle the application lifecycle events, when the user leaves your application, then navigates back to it via the back-button you application is re-started either from a dormant or tombstoned state.
You can read about the lifecycle here:
http://www.scottlogic.co.uk/blog/colin/2011/10/a-windows-phone-7-1-mango-mvvm-tombstoning-example/
You need to add logic into the Activated event. At this point you could display a logic Popup that ensures the user has to re-enter their credentials to continue using the application.
The best way is to create separate view like UserControl and then show it as Popup when you need user to log in.
This is the way recommended by Microsoft also, and zou won't be having this navigation problems.
Something like this:
enter link description here