Current time: 05-05-2024, 05:55 PM Hello There, Guest! (LoginRegister)


Post Reply 
Password generator for reseller when add user
Author Message
itanium Offline
Junior Member
*

Posts: 35
Joined: Apr 2007
Reputation: 0
Post: #1
Password generator for reseller when add user
A small enhancement for reseller that generate an random password when you add a user.

[Image: i77_passgen.JPG]

Simply copy / paste the generate password in the password and password repeat case. The password is not added automatically

Code:

1). Create a passgen.php in /var/www/ispcp/gui/themes/omega_original/css

Code:
<?php
function createPassword($length) {
    $chars = "234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $i = 0;
    $password_gen = "";
    while ($i <= $length) {
        $password_gen .= $chars{mt_rand(0,strlen($chars))};
        $i++;
    }
    return $password_gen;
}
$password_gen = createPassword(8);

?>
<table style="text-align: left; width=200px;" border="0" cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td style="background-color: rgb(255, 204, 204);">
<?=$password_gen?><br />
    </tr>
  </tbody>
</table>
<form action="passgen.php" method="get">
<input type="submit" value="Go" />
</form>

2). In /var/www/ispcp/gui/themes/omega_original/reseller edit user_add3.tpl and after:

Code:
<tr>
<td width="25">&nbsp;</td>
<td class="content2" width="200">{TR_USERNAME}</td>
<td class="content">{VL_USERNAME}</td>
</tr>

add this:

Code:
<tr>
<td width="25">&nbsp;</td>
<td class="content2" width="200">{TR_PASSWORD_GENERATOR}</td>
<td class="content">
<object type="text/html" data="{THEME_COLOR_PATH}/css/passgen.php"" width="100%" height="80px">
</object>
</td>
</tr>
<tr>

3.) In /var/www/ispcp/gui/reseller edit user_add3.php and after:

Code:
'TR_CORE_DATA' => tr('Core data'),

add this

Code:
'TR_PASSWORD_GENERATOR' => tr('Generate password'),

4.) Edit you language file (french exemple) and add:

Code:
Generate password = Générer Mot de passe

Enjoy Wink.

Ps: I'm not able to provided this file because i have hacked some part of this.
I will integrate this script in several place like ftp account creation, mysql mail ..
(This post was last modified: 01-07-2009 02:24 AM by itanium.)
01-06-2009 07:53 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Password generator for reseller when add user - itanium - 01-06-2009 07:53 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)