- 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',
attribute: this.name,
objecttype: varLSform.objecttype,
objectdn: varLSform.objectdn,
idform: varLSform.idform
};
data.imgload=varLSdefault.loadingImgDisplay(this.generateBtn);

View file

@ -97,11 +97,15 @@ if (!isset($_ERRORS)) {
}
break;
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'])) {
$object = new $_REQUEST['objecttype']();
if ($object) {
if ($object -> loadData($_REQUEST['objectdn'])) {
$form = $object -> getForm($_REQUEST['idform']);
if ($form) {
$field=$form -> getElement($_REQUEST['attribute']);
if ($field) {
$val = $field -> generatePassword();
if ( $val ) {
$data = array(
@ -109,6 +113,10 @@ if (!isset($_ERRORS)) {
);
}
}
}
}
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode(1004,$_REQUEST['objecttype']);
}