- LSformElement_password : Bug dans la génération d'un mot de passe

via Ajax
This commit is contained in:
Benjamin Renard 2009-04-09 09:28:48 +00:00
parent 6c9623a948
commit b2bcde9cb9

View file

@ -125,7 +125,7 @@ class LSformElement_password extends LSformElement {
); );
if (($this -> params['html_options']['generationTool'])&&($this -> params['html_options']['autoGenerate'])&&(empty($this -> values))) { if (($this -> params['html_options']['generationTool'])&&($this -> params['html_options']['autoGenerate'])&&(empty($this -> values))) {
$pwd=$this->generatePassword(); $pwd=$this->generatePassword($this -> params);
} }
$params = array( $params = array(
@ -144,8 +144,8 @@ class LSformElement_password extends LSformElement {
return $return; return $return;
} }
function generatePassword() { function generatePassword($param=NULL) {
return generatePassword($this -> params['html_options']['chars'],$this -> params['html_options']['lenght']); return generatePassword($params['html_options']['chars'],$params['html_options']['lenght']);
} }
function verifyPassword($pwd) { function verifyPassword($pwd) {
@ -206,20 +206,12 @@ class LSformElement_password extends LSformElement {
public static function ajax_generatePassword(&$data) { public static function ajax_generatePassword(&$data) {
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) { if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) { if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype'](); $params = LSconfig :: get("LSobjects.".$_REQUEST['objecttype'].".attrs.".$_REQUEST['attribute']);
if ($object) { $val = self :: generatePassword($params);
$form = $object -> getForm($_REQUEST['idform']); if ( $val ) {
if ($form) { $data = array(
$field=$form -> getElement($_REQUEST['attribute']); 'generatePassword' => $val
if ($field) { );
$val = $field -> generatePassword();
if ( $val ) {
$data = array(
'generatePassword' => $val
);
}
}
}
} }
} }
} }