[selfpasschanger]
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="/~style.css" type="text/css">
<style fprolloverstyle>A:hover {color:#b30000; font-style: italic;}
</style>
<br/>
<title>{.!Change my Password.}</title>
</head>
<body>
<div id='body'>
<img src="/~img27"><font size="3" color=555"> {.!Welcome.} %user% !</font size>
<br/><hr color=555"> </b>
<br/>
- {.!To use this function, simply enter your.} <b>{.!New Password.}</b>.<p>
- {.!Then.} {.!click on.} <FONT COLOR=firebrick><b>{.!Change.}</b></FONT COLOR=firebrick>.
<br/>
<br/>
<p>
<br/>
<form method=post action="/~selfpasschange?remotefolder={.?remotefolder.}">
<table>
<tr><td align=left><b><font size="4">{.!Username.}</font></b><td><b><font size="4"> </b><INPUT READONLY NAME="name" value="%user%" style="font-size:10pt; font-weight:bold; color:7F7F7F; background-color:FFFFFF; border:3px solid #AB9F82;" size="25">
<tr><td align=left><b><font size="4">{.!New Password.}</font></b><td><b><font size="4"> </font></b><span style="background-color: #000000"><input name="newpass" style="font-size:10pt; font-weight:bold; color:7F7F7F; background-color:FFFFFF; border:3px solid #AB9F82;" size="25"></span>
<tr><td align=left><font size="4"><td align=center><br/><input type=submit value="{.!Change.}">
</tr></table>
<br/>
<hr color=555">
<center><a href="{.?remotefolder.}">{.!UP.}{.repeat|2| .}</a></p></center>
</form>
</body>
</html>
[selfpasschange]
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="/~style.css" type="text/css">
<style fprolloverstyle>A:hover {color:#b30000; font-style: italic;}
</style>
<br/>
<title>{.!Pass Changer.}</title>
</head>
<body>
<div id='body'>
{.set account|{.postvar|name.}|password={.postvar|newpass.}.}
<img src="/~img27"><font size="3" color=555"> %user% </font>
<br/>
<hr color=555">
<br/>
<p><font size="4">{.if|{.get|account|{.postvar|name.}|{.postvar|newpass.}.}|<b>{.!The new password is.}/if.} </b>: <font size="4" color=555"><INPUT READONLY NAME="name" value="{.postvar|newpass.}" style="text-align:center; font-size:10pt; font-weight:bold; color:7F7F7F; background-color:FFFFFF; border:3px solid #AB9F82;" size="35"></font></p>
<br/>
<hr color=555">
<center><a href="{.?remotefolder.}">{.!UP.}{.repeat|2| .}</a></p></center>
</form>
</body>
</html>
Nice, but would it be possible to ask the user the new password twice and check for consistency?
Yes, it probably possible, but in this present case, the new password is filled in the field in text mode (not *****) by the user.
It seems to me rather pointless to confirm twice what the user can visualize while writing.
And in addition the new password is displayed after it is created ... the user may copy it for archiving. :)
But perhaps you used an imput type "password"?
<script type="text/javascript">
function validatePassword(form){
if (form.pass1.value != form.pass2.value){
alert("Password mismatch: please enter again.");
return false;
}
return true;
}
</script>
<form method=post action="/~userpasschange" onsubmit="return validatePassword(this);">
<table>
<tr><td align=left><b><font size="4"><font size="4">New Password</font></b></font></b><td><b><font size="4">: </font></b><span style="background-color: #000000"><input name=pass1 type=password style="font-size:10pt; font-weight:bold; border:1px solid #88f" size="20" ></span>
<tr><td align=left><b><font size="4"><font size="4">Type Password again</font></b></font></b><td><b><font size="4">: </font></b><span style="background-color: #000000"><input name=pass2 type=password style="font-size:10pt; font-weight:bold; border:1px solid #88f" size="20" ></span>
<tr><td align=left><font size="4">Click <a href="/">here</a> to return to HOME.</font><td align=center><input type=submit value="Change">
</tr></table>
</form>
What is still open is a peace of code that cleans the entered fields and set the focus on the first widget for the new password
QuoteWhat is still open is a peace of code that cleans the entered fields and set the focus on the first widget for the new password
when should such actions be taken?
you can do something like
form.pass1.value = "";
form.pass2.value = "";
form.pass1.focus();
you asked for a code to clean&focus, so how can you say it does not work because the password is changed.
it has nothing to do with it. it's like complaning because it does not wash your car :)
<form method=post action="/~userpasschange" onsubmit="return validatePassword(this);">
<table>
<tr><td align=left><b><font size="4"><font size="4">New Password</font></b></font></b><td><b><font size="4">: </font></b><span style="background-color: #000000"><input name=pass1 type=password style="font-size:10pt; font-weight:bold; border:1px solid #88f" size="20" ></span>
<tr><td align=left><b><font size="4"><font size="4">Type Password again</font></b></font></b><td><b><font size="4">: </font></b><span style="background-color: #000000"><input name=pass2 type=password style="font-size:10pt; font-weight:bold; border:1px solid #88f" size="20" ></span>
<tr><td align=left><font size="4">Click <a href="/">here</a> to return to HOME.</font><td align=center><input type=submit value="Change">
</tr></table>
</form>
<script type="text/javascript">
function validatePassword(form){
if (form.pass1.value != form.pass2.value){
alert("Password mismatch: please enter again.");
return false;
}
return true;
}
</script>
<script type="text/javascript">
function validatePassword(form){
if (form.pass1.value != form.pass2.value){
alert("Password mismatch: please enter again.");
return false;
from.pass1.value = "";
from.pass2.value = "";
form.pass1.focus();
}
return true;
}
</script>
try fixing "from." in "form."
and move my code before the alert()