rejetto forum
May 25, 2012, 01:12:15 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: How can users of my side can be allowed to change their passwords once created  (Read 2632 times)
0 Members and 3 Guests are viewing this topic.
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11830


View Profile
« Reply #15 on: April 21, 2009, 02:21:48 PM »

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 Smiley
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #16 on: April 23, 2009, 08:32:17 AM »

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 Smiley

Maybe you got me wrong.

Let's summarize once again:

This is the current peace of code:

Code:
<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">: &nbsp;</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">: &nbsp;</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>

It uses a java script called "validatePassword" to check that pass1 and pass2 match:

Code:
<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>

It works fine. If pass1 != pass2 then there is a message box and the user has to enter the new password again.

But first the user must "clean" the fields pass1 and pass2.

Here it comes your hint and I modified the java code:

Code:
<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>

Now the message box pops up but the password is ALWAYS changed, even if the pass1 !=  pass2 !

Is it clear now?

PS: Sorry for such a silly questions, but I'm not a java expert Sad
Logged

Life is what happens to you while you are busy making other plans
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11830


View Profile
« Reply #17 on: April 23, 2009, 07:09:06 PM »

try fixing "from." in "form."
and move my code before the alert()
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #18 on: April 24, 2009, 02:46:16 AM »

try fixing "from." in "form."
and move my code before the alert()

DAMMIT!!! YOU ARE RIGHT !!!

...I'm getting old  Sad

PS: It is working also without moving the code before the alert()  Wink
« Last Edit: April 24, 2009, 02:48:06 AM by luca69 » Logged

Life is what happens to you while you are busy making other plans
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 21, 2012, 07:32:09 AM
anything