Refresh Registration page after submitting - submit

In my site, I have made a registration page named registration.php. When I submits it redirects to reg_success.php. But If i press back button after my succesful registration, then also the registration page i.e registration.php remains filled. I want that if my registration is complete and I press back on browser then my registration page should come blank.
Kindly help me, what code I need to add to the registration page on clicking back on browser.

Use following line of code :
window.location.reload();
or also you can use following way :
window.location.href = window.location.href;

Related

Revisiting index page after login

I am new so please be willing to lend me a hand.
I am into a web application that a user needs to enter his credentials in a form set for the login page (index.aspx).
After he signs on, he'll be redirected to a content page (content-page-for-user-x.aspx).
He does open many more subpages and finally enters "index.aspx" in the browser to get back the index page.
What should I do to prevent the index.aspx (login form page) from showing up again? Because he is already in, not new at all. The index page now should be content-page-for-user-x.aspx.
In backend logic of login page index.aspx, you could check if user has already logged in.
If user has already logged in, just redirect user to content-page-for-user-x.aspx should be fine. If user not logged in, display your login page (index.aspx) to prompt user to login.

Token session interceptor not submitting modfied form

I am using struts2 framework for my application.I have two pages. Page1 with form1 having modifiable data and submit button. I am using token session interceptor to prevent form re submission . On clicking submit from page1 it will call an action and navigate to Page2 and show the success/failure result.
The problem is if I use browser back button from Page2 to navigate back to Page1 and modify some form1 data and click submit, token session interceptor not calling the action again instead navigating to Page2 with previous result .
While using browser back button I need to prevent form re-submission if there is no change in data, on the other hand I need to submit the data if there is a modification.
You need to tell the browser not to cache anything, so when the back button is clicked, the browser tries to load the page again. For this purpose you need to write a caching interceptor that will set headers to response to instruct the browser to not cache pages. See Why after logout clicking back button on the page displays previous page content.

Navigate to original requested page

I have page where are secured by session. In case session does exists, then navigate to login page. This works fine.
Now, Let's say I am at some page like abc.aspx. Session does not exists. System navigates to th login page. So, once login, can i navigate the user to the page which was originally requested ?
Usually it is performed by adding the requested URL as a query parameter to Login page URL http://fakehost/Login?retUrl=originalpage
so app code can redirect it back. Forms authentication mechanism does it for you.
yes you can however it would be recommended to add a ReturnUrl querystring which contains the page they came from or need to go to after they logged in. you can also use Request.UrlReferrer I believe which gives you the page they came from but means if for example they came from google to your site to login and you redirect, it would go back to google.

How To Sign Out Using When Using Google+ Sign-In

Google documents there gapi.auth.signOut() method here: https://developers.google.com/+/web/signin/#sign-out
The catch is that it says you can only call that method after the signinCallback has fired. So far as I can tell, the only way to fire the signinCallback is to put a sign-in button on the page.
This works great on my sign-in page itself, but as soon as I've authenticated a user, there's no need to put the G+ sign-in button on subsequent pages. I just want to have a small 'log out' link in the corner that the user can click to sign-out.
I tried having my log-out link call gapi.auth.signOut() but it does nothing unless I am also showing a useless log-in button. How do I get this to work?
The button just has to be in the DOM, it doesn't have to be showing. What seems to work well is:
Create a hidden element and attach the gapi handler with gapi.signin.render
Wait for the immediate_failed error - display the button then
Otherwise, accept the signed in callback, and display the logout button
Then you'll get a callback every time, but only show the button when signed out.

logout does not work properly in struts2

i am developing a struts project.
In login page action stored username and password in session.
In logout action class using session.invalid and removed that session details and redirected to index page.
But i click back button in browser it goes to the previous page.
Now i need sample code for if i am clicking back button after logging out it will show the error message or it display index page like yahoo mail.
need sample for that in struts2
As I know, very hard to do JS side. because back button belong to web browser. Our project do below way:
When logout, close currently window and open new window. that will help you clear history.

Resources