rejetto forum
May 25, 2012, 01:07:48 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 1 Guest are viewing this topic.
nrthombare
Occasional poster
*
Offline Offline

India India

Posts: 1


View Profile
« on: March 30, 2009, 12:26:34 AM »

How can users of my side can be allowed to change their passwords once created

PL specify how?
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11830


View Profile
« Reply #1 on: March 30, 2009, 05:49:44 AM »

we are working on this feature.
the default template doesn't include it yet.
only few did it.
Logged
SilentPliz
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1046


....... chut ! shh!


View Profile WWW
« Reply #2 on: March 30, 2009, 09:28:47 AM »

   
For that the user will change his password ...

One condition:
Use a recent beta version of HFS:

In the default template for that version, add:

For the menu, add the blue line:

{.if not| %user%          | <li><a href="~login"><img src="/~img27"> Login</a></li> .}
{.if| %user%          | <li><a href="/~selfpasschanger?remotefolder=%folder%"><center>{.!Change Password.}</center></a></li> .}
{.if| {.get|can upload.}  | <li><a href="~upload"><img src="/~img32"> Upload</a></li> .}


Then add the following before the section [special:strings]:

Code:
[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"> &nbsp;</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"> &nbsp;</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|&nbsp;.}</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|&nbsp;.}</a></p></center>
</form>
</body>
</html>


It is possible to do better... like to demanding the old password for verification before accept the new one... but the required changes are not yet included in the official "beta".
« Last Edit: March 31, 2009, 07:45:26 AM by SilentPliz » Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #3 on: April 01, 2009, 08:21:23 AM »

Nice, but would it be possible to ask the user the new password twice and check for consistency?
Logged

Life is what happens to you while you are busy making other plans
SilentPliz
Operator
Insane poster
*****
Offline Offline

France France

Posts: 1046


....... chut ! shh!


View Profile WWW
« Reply #4 on: April 01, 2009, 10:41:01 AM »

   
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.  Smiley

But perhaps you used an imput type "password"?
« Last Edit: April 01, 2009, 06:30:19 PM by SilentPliz » Logged
TCube
Insane poster
*****
Offline Offline

France France

Posts: 431



View Profile
« Reply #5 on: April 01, 2009, 01:07:52 PM »

Nice, but would it be possible to ask the user the new password twice and check for consistency?


Let me change one thing in my signature : " .... someone will make a better idiot"

 Grin

I'm out .....
Logged

Make it idiot-proof and I will make a better idiot
rejetto forum
« Reply #5 on: April 01, 2009, 01:07:52 PM »

Do you like this software? Consider even $2
 Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #6 on: April 02, 2009, 06:17:07 AM »

   
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.  Smiley

But perhaps you used an imput type "password"?

Yes I used the type "password" so that the text entered by the user is not visible.
I searched for a simple peace of code to do the comparison between two text/password fields, but I google was not giving me a solution Sad
Any hint?
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 #7 on: April 02, 2009, 09:01:55 AM »

you should first duplicate the field.
since the password field is named "newpass", this duplicate should be named "newpass2".

Then you should have in the other page a code like this
{.if|{.{.postvar|newpass.} = {.postvar|newpass2.}.}
|{:{.set account|%user%|password={.postvar|newpass.}.}:}
|the two passwords don't match, retry
/if.}

Please, notice i changed {.postvar|name.} with %user% here, because the version posted by SP is very dangerous. Any skilled user can remove the "readonly" thing and change the passwords of other accounts. Using "firebug" plugin (for firefox) is very easy.



finally and optionally, you may use a javascript code that will prevent submitting if the two passwords are different.

this can be done by adding to the submit button this value

onclick="if (document.newpass.value != document.newpass2.value) { alert('Error, please retype your passwords'); return false; }"

(this code is untested, may require some fixing)
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #8 on: April 03, 2009, 10:19:32 AM »

Thanks for the hint: I'll try to use the java code  Wink

Logged

Life is what happens to you while you are busy making other plans
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #9 on: April 06, 2009, 07:54:34 AM »

I completely forgot that I already solved the problem with the following function:
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>

and in the form the 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>

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
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 #10 on: April 07, 2009, 09:10:18 AM »

you may decide to use my version in case you want it to be compatible with no javascript. it's up to your needs.

Quote
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

when should such actions be taken?
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #11 on: April 14, 2009, 04:55:34 AM »


Quote
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

when should such actions be taken?

Just in case the 2 passwords entered do not match Wink
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 #12 on: April 15, 2009, 10:13:12 AM »

you can do something like
form.pass1.value = "";
form.pass2.value = "";
form.pass1.focus();
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #13 on: April 17, 2009, 02:34:47 AM »

Thanks for the hint ... I'll try
Logged

Life is what happens to you while you are busy making other plans
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #14 on: April 21, 2009, 06:32:37 AM »

you can do something like
form.pass1.value = "";
form.pass2.value = "";
form.pass1.focus();


It does not work Sad If you put that peace of code, the password is ALWAYS changed (even if pass1 != pass2)
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, 05:45:17 AM
anything