I created a confirm alert for throwing a message if a particular user's password is about to expired and request them to change their password.
I created a function for this in the header.
If user successfully logs in, they will be directed to the home page (where I call the function - index.jsp
).
The confirm alert will show up (as expected) when user successfully login.
Then, each time user clicks the Home menu (index.jsp
page), the confirm alert will show up again.
How to make it to show up only once?
I want to make it appear just when user successfully login to the page.
Anyone can help? Would appreciate it so much.
This is in the header.jsp
:
function pwdAlert(){
<%if(!headerexpDay.equals("") && Integer.parseInt(headerexpDay) <= 10 ){%>
var expDay = "<%=headerexpDay%>";
if(confirm("Your login password will be expired in "+expDay+" day(s). Do you want to change password?")){
document.frmHeader.method = "POST";
document.frmHeader.action= "<%=request.getContextPath()%>/admin/frmChangePassword.jsp";
document.frmHeader.target= "_self";
document.frmHeader.submit();
}
<%}%>
}
And this is in the index.jsp
(home page) where I call the function.
<SCRIPT>
document.onreadystatechange = function () {
if (document.readyState === "complete") {
pwdAlert();
}
}
</SCRIPT>