Routine pour suggérer des mots de passe compliqué.

Maintenant, faut l'intégrer dans les pages web
This commit is contained in:
Alan Garcia 2012-11-08 13:27:46 +00:00
parent 639e948dfd
commit 50fb508e6a
5 changed files with 35 additions and 8 deletions

1
.gitattributes vendored
View File

@ -252,6 +252,7 @@ bureau/admin/images/passwordstrength.jpg -text
bureau/admin/images/plus.png -text
bureau/admin/images/pumpkin.png -text
bureau/admin/images/quota.png -text
bureau/admin/images/refresh.png -text
bureau/admin/images/row-down.png -text
bureau/admin/images/row-down.png2 -text
bureau/admin/images/schedule.png -text

View File

@ -66,14 +66,8 @@ if (isset($error) && $error) {
<label for="login"><?php __("Username"); ?></label></th><td>
<select class="inl" name="prefixe"><?php $ftp->select_prefix_list($prefixe); ?></select>&nbsp;<b>_</b>&nbsp;<input type="text" class="int" name="login" id="login" value="" size="20" maxlength="64" />
</td></tr>
<tr><th><label for="dir"><?php __("Folder"); ?></label></th><td><input type="text" class="int" name="dir" id="dir" value="" size="20" maxlength="255" />
<script type="text/javascript">
<!--
document.write("&nbsp;<input type=\"button\" name=\"bff\" onclick=\"browseforfolder('main.dir');\" value=\" <?php __("Choose a folder..."); ?> \" class=\"bff\">");
// -->
</script>
</td></tr>
<tr><th><label for="pass"><?php __("Password"); ?></label></th><td><input type="password" class="int" name="pass" id="pass" value="" size="20" maxlength="64" /></td></tr>
<tr><th><label for="dir"><?php __("Folder"); ?></label></th><td><input type="text" class="int" name="dir" id="dir" value="" size="20" maxlength="255" /></td></tr>
<tr><th><label for="pass"><?php __("Password"); ?></label></th><td><input type="password" class="int" name="pass" id="pass" value="" size="20" maxlength="64" /><?php display_div_generate_password(); ?></td></tr>
<tr><th><label for="passconf"><?php __("Confirm password"); ?></label></th><td><input type="password" class="int" name="passconf" id="passconf" value="" size="20" maxlength="64" /></td></tr>
<tr class="trbtn"><td colspan="2">
<input type="submit" class="inb" name="submit" value="<?php __("Create this new FTP account."); ?>" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

View File

@ -209,3 +209,27 @@ function false_if_empty(id,err_msg) {
return false;
}
}
function generate_password(len){
len = parseInt(len);
if(!len)
len = 8;
var password = "";
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var charsN = chars.length;
var nextChar;
for(i=0; i<len; i++){
nextChar = chars.charAt(Math.floor(Math.random()*charsN));
password += nextChar;
}
return password;
}
function generate_password_html(id, size) {
$("#"+id).html("<input type='textbox' size=8 disabled value='"+generate_password(size)+"' />&nbsp;<a href='javascript:generate_password_html("+id+","+size+");'><img src='/images/refresh.png' alt='Refresh'/></a>");
}

View File

@ -600,6 +600,14 @@ function create_pass($length = 8){
}
function display_div_generate_password($pass_size=8) {
$id=rand(1,1000);
echo "<div id='$id' style='display:none;'><a href=\"javascript:generate_password_html('$id',$pass_size);\">";
__("Clic here to generate a password");
echo "</a></div>";
echo "<script type='text/javascript'>$('#'+$id).show();</script>";
return 0;
}
?>