RFE #1197482, password generator on user creation. RFC: ok like that? TODO: add strings.

This commit is contained in:
Olivier Müller
2005-05-16 22:29:01 +00:00
parent e8be67e72e
commit 75833b0cd9
3 changed files with 61 additions and 0 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2005-05-17 Olivier Mueller <om@omnis.ch>
* server_privileges.php, libraries/server_privileges.js: RFE #1197482,
password generator on user creation. RFC: ok like that? TODO: add strings.
2005-05-15 Marc Delisle <lem9@users.sourceforge.net>
* sql.php, libraries/sqlparser.lib.php: bug #1120434, comment at the end
of query is applied to appended LIMIT as well

View File

@@ -86,3 +86,46 @@ function setCheckboxes(the_form, the_checkboxes, do_check)
return true;
} // end of the 'setCheckboxes()' function
/**
* Generate a new password, which may then be copied to the form
* with suggestPasswordCopy().
*
* @param string the form name
*
* @return boolean always true
*/
function suggestPassword(the_form)
{
var pwchars = "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ.,:";
var passwordlength = 16; // do we want that to be dynamic? no, keep it simple :)
var passwd = '';
for (i=0;i<passwordlength;i++)
{
passwd+=pwchars.charAt(Math.floor(Math.random()*pwchars.length))
}
document.forms[the_form].generated_pw.value = passwd;
return true;
}
/**
* Copy the generated password (or anything in the field) to the form
*
* @param string the form name
*
* @return boolean always true
*/
function suggestPasswordCopy(the_form)
{
document.forms[the_form].pma_pw.value = document.forms[the_form].generated_pw.value;
document.forms[the_form].pma_pw2.value = document.forms[the_form].generated_pw.value;
return true;
}

View File

@@ -548,6 +548,20 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0)
. $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
. $spaces . ' <input type="password" name="pma_pw2" id="text_pma_pw2" class="textfield" title="' . $GLOBALS['strReType'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n"
. $spaces . ' </td>' . "\n"
. $spaces . '</tr>' . "\n"
. $spaces . '<tr>' . "\n"
. $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
. $spaces . ' <label for="text_pma_pw2">' . "\n"
. $spaces . ' ' . $GLOBALS[''] . 'Generate Password:' . "\n"
. $spaces . ' </label>' . "\n"
. $spaces . ' </td>' . "\n"
. $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
. $spaces . ' <input type="button" value="Generate" onClick="suggestPassword(\'usersForm\', \'generated_pw\')">' . "\n"
. $spaces . ' <input type="button" value="Copy" onClick="suggestPasswordCopy(\'usersForm\')">' . "\n"
. $spaces . ' &nbsp;</td>' . "\n"
. $spaces . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
. $spaces . ' <input type="text" name="generated_pw" id="generated_pw" class="textfield"/>' . "\n"
. $spaces . ' </td>' . "\n"
. $spaces . '</tr>' . "\n";
} // end of the 'PMA_displayUserAndHostFields()' function