a "random password generator", so I made this addon.
What does it do?
It adds a checkbox under the password field "* Check if you want to get a new random password"
If checked, after clicking the submit button it will generate a random password, send it to the user
by mail and show a message in the following page!
If not checked the password will stay the same and no email or message will be showed.
Installation
0. Open inc/mod/personal.mdu
1. If you have installed my 'Password Strength Check' Find this:
- Code: Select all
<div style="float:right;"><br> <?=$echo['ifNeedNewPass']; ?><br><br></div>
</div>
* This is the end of the password field, if you have not installed the passcheck then Find this:
- Code: Select all
<td height="21" width="400" colspan="2"><input name="editpassword"> <?=$echo['ifNeedNewPass']; ?>
After Add:
- Code: Select all
<tr <?=cute_that(); ?>>
<td height="21">
<td height="21" width="400" colspan="2">* Check if you want to get a new random password <input type="checkbox" name="randompass" id="randompass">
* You can edit what's to be shown near the checkbox
2. Find this:
- Code: Select all
foreach ($sql->select(array('table' => 'users', 'where' => array("id = $member[id]"))) as $row){
if ($editpassword){
$row['password'] = md5x($editpassword);
$_SESSION['md5_password'] = $row['password'];
if (cookie){
setcookie('md5_password', $row['password']);
}
}
After Add:
- Code: Select all
//DarkSlim - Random Password Generator
else if ($randompass){
$randompass = makeRandomPassword();
$row['password'] = md5x($randompass);
$_SESSION['md5_password'] = $row['password'];
if (cookie){
setcookie('md5_password', $row['password']);
}
$rpsubject = 'Your new Password';
$rpmsg = 'As you have chosen to receive a new password, this is your new password: <br>'.$randompass.'<br>';
cute_mail($row['mail'], $rpsubject, sprintf($rpmsg, $row['username'], $randompass));
$randomSaved = '<br><br>As you have chosen to receive a new password, this is your new password: '.$randompass.'<br>Please save it for later use.';
}
* You can edit the subject and message that the user will recieve
3. Find this (at the end):
- Code: Select all
msg('info', $echo['headerSaved'], $echo['changeSaved']......
Change it to:
- Code: Select all
msg('info', $echo['headerSaved'], $echo['changeSaved'].$avatar_error.$randomSaved, $PHP_SELF.'?mod=personal');
That's it, now you can upload and check it, hope it help
and I'de be glad to hear what you think of it
DarkSlim
