- LSformElement_password : Correction de la méthode de génération de mot de

passe via Ajax bugant dans certain cas.
This commit is contained in:
Benjamin Renard 2008-12-06 00:17:26 +00:00
parent eac7ef4d46
commit ef6e0eda4d
2 changed files with 17 additions and 8 deletions

View file

@ -140,6 +140,7 @@ var LSformElement_password_field = new Class({
action: 'generatePassword', action: 'generatePassword',
attribute: this.name, attribute: this.name,
objecttype: varLSform.objecttype, objecttype: varLSform.objecttype,
objectdn: varLSform.objectdn,
idform: varLSform.idform idform: varLSform.idform
}; };
data.imgload=varLSdefault.loadingImgDisplay(this.generateBtn); data.imgload=varLSdefault.loadingImgDisplay(this.generateBtn);

View file

@ -97,16 +97,24 @@ if (!isset($_ERRORS)) {
} }
break; break;
case 'generatePassword': case 'generatePassword':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['idform'])) ) { if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype'](); $object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']); if ($object) {
$field=$form -> getElement($_REQUEST['attribute']); if ($object -> loadData($_REQUEST['objectdn'])) {
$val = $field -> generatePassword(); $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
);
}
}
}
}
} }
} }
else { else {