diff --git a/src/includes/class/class.LSsession.php b/src/includes/class/class.LSsession.php index f6475c3f..bd00fd32 100644 --- a/src/includes/class/class.LSsession.php +++ b/src/includes/class/class.LSsession.php @@ -708,10 +708,10 @@ class LSsession { // topDn if (isset($_POST['LSsession_topDn']) && $_POST['LSsession_topDn'] != '' ){ - self :: $topDn = $_POST['LSsession_topDn']; + self :: setSubDn($_POST['LSsession_topDn']); } else { - self :: $topDn = self :: $ldapServer['ldap_config']['basedn']; + self :: setSubDn(self :: $ldapServer['ldap_config']['basedn']); } $_SESSION['LSsession_topDn']=self :: $topDn; @@ -831,6 +831,8 @@ class LSsession { } elseif (!empty($username)) { $users = LSauth :: username2LSobjects($username); + if (!is_array($users)) + return; } else { self :: log_debug('recoverPasswd(): no username or recoveryHash provided.'); @@ -2786,7 +2788,7 @@ class LSsession { } /** - * Ajax method when change ldapserver on login form + * Ajax method when change ldapserver on login/recoveryPassword form * * @param[in] $data array The return data address * @@ -2814,20 +2816,6 @@ class LSsession { } } - /** - * Ajax method when change ldapserver on recoverPassword form - * - * @param[in] $data array The return data address - * - * @retval void - **/ - public static function ajax_onLdapServerChangedRecoverPassword(&$data) { - if ( isset($_REQUEST['server']) ) { - self :: setLdapServer($_REQUEST['server']); - $data=array('recoverPassword' => isset(self :: $ldapServer['recoverPassword'])); - } - } - /** * Set globals from the ldap server * diff --git a/src/includes/js/LSsession_recoverPassword.js b/src/includes/js/LSsession_recoverPassword.js index d41a9ce6..e8087a8d 100644 --- a/src/includes/js/LSsession_recoverPassword.js +++ b/src/includes/js/LSsession_recoverPassword.js @@ -29,7 +29,7 @@ var LSsession_recoverPassword = new Class({ server: server, imgload: imgload }; - new Request({url: 'ajax/class/LSsession/onLdapServerChangedRecoverPassword', data: data, onSuccess: this.onLdapServerChangedComplete.bind(this)}).send(); + new Request({url: 'ajax/class/LSsession/onLdapServerChangedLogin', data: data, onSuccess: this.onLdapServerChangedComplete.bind(this)}).send(); }, onLdapServerChangedComplete: function(responseText, responseXML){ @@ -37,14 +37,24 @@ var LSsession_recoverPassword = new Class({ var data = JSON.decode(responseText); LSdebug(data); if ( varLSdefault.checkAjaxReturn(data) ) { + if (data.list_topDn) { + $('LSsession_topDn').getParent().set('html',data.list_topDn); + $('LSsession_topDn_label').set('html',data.subDnLabel); + $$('.recoverpasswordform-level').each(function(el) { + el.setStyle('display','block'); + }); + } + else { + this.recoverpasswordformLevelHide(); + } if (data.recoverPassword) { this.enableInput(); } } }, - loginformLevelHide: function(){ - $$('.loginform-level').each(function(el) { + recoverpasswordformLevelHide: function(){ + $$('.recoverpasswordform-level').each(function(el) { el.setStyle('display','none'); }); $('LSsession_topDn').empty(); diff --git a/src/templates/default/recoverpassword.tpl b/src/templates/default/recoverpassword.tpl index cc399489..e41ba150 100644 --- a/src/templates/default/recoverpassword.tpl +++ b/src/templates/default/recoverpassword.tpl @@ -14,6 +14,8 @@