From ef6e0eda4dd4c963bebc690864cfec409cbb63ca Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sat, 6 Dec 2008 00:17:26 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSformElement=5Fpassword=20:=20Correction?= =?UTF-8?q?=20de=20la=20m=C3=A9thode=20de=20g=C3=A9n=C3=A9ration=20de=20mo?= =?UTF-8?q?t=20de=20=09passe=20via=20Ajax=20bugant=20dans=20certain=20cas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/LSformElement_password_field.js | 1 + trunk/index_ajax.php | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/trunk/includes/js/LSformElement_password_field.js b/trunk/includes/js/LSformElement_password_field.js index 882e7426..056cc2d7 100644 --- a/trunk/includes/js/LSformElement_password_field.js +++ b/trunk/includes/js/LSformElement_password_field.js @@ -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); diff --git a/trunk/index_ajax.php b/trunk/index_ajax.php index a27d9dfa..1894ddc3 100644 --- a/trunk/index_ajax.php +++ b/trunk/index_ajax.php @@ -97,16 +97,24 @@ 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'](); - $form = $object -> getForm($_REQUEST['idform']); - $field=$form -> getElement($_REQUEST['attribute']); - $val = $field -> generatePassword(); - if ( $val ) { - $data = array( - 'generatePassword' => $val - ); + 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( + 'generatePassword' => $val + ); + } + } + } + } } } else {