diff --git a/trunk/css/black/login.css b/trunk/css/black/login.css index f29a746d..2b171881 100644 --- a/trunk/css/black/login.css +++ b/trunk/css/black/login.css @@ -58,10 +58,14 @@ dl.loginform { margin-left: 1em; } -#LSsession_lostPassword { +#LSsession_recoverPassword { float: right; font-size: 0.8em; text-decoration: none; color: #53504b; font-weight: bold; } + +.LSsession_recoverPassword_hidden { + visibility: hidden; +} diff --git a/trunk/css/default/login.css b/trunk/css/default/login.css index 675b76cd..9f153263 100644 --- a/trunk/css/default/login.css +++ b/trunk/css/default/login.css @@ -54,10 +54,14 @@ dl.loginform { margin-left: 1em; } -#LSsession_lostPassword { +#LSsession_recoverPassword { float: right; font-size: 0.8em; text-decoration: none; color: #4096b8; font-weight: bold; } + +.LSsession_recoverPassword_hidden { + visibility: hidden; +} diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 6826a529..5f999982 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -734,9 +734,7 @@ class LSsession { $GLOBALS['Smarty'] -> assign('loginform_label_user',_('Identifiant')); $GLOBALS['Smarty'] -> assign('loginform_label_pwd',_('Mot de passe')); $GLOBALS['Smarty'] -> assign('loginform_label_submit',_('Connexion')); - if (isset($GLOBALS['LSconfig']['ldap_servers'][0]['recoverPassword'])) { - $GLOBALS['Smarty'] -> assign('loginform_label_lostpassword',_('Mot de passe oubliƩ ?')); - } + $GLOBALS['Smarty'] -> assign('loginform_label_recoverPassword',_('Mot de passe oubliƩ ?')); $this -> setTemplate('login.tpl'); $this -> addJSscript('LSsession_login.js'); @@ -795,7 +793,7 @@ class LSsession { $GLOBALS['Smarty'] -> assign('recoverpassword_msg',$recoverpassword_msg); $this -> setTemplate('recoverpassword.tpl'); - $this -> addJSscript('LSsession_recoverpassword.js'); + $this -> addJSscript('LSsession_recoverPassword.js'); } /** diff --git a/trunk/includes/js/LSsession_login.js b/trunk/includes/js/LSsession_login.js index 148c1f24..14c641e3 100644 --- a/trunk/includes/js/LSsession_login.js +++ b/trunk/includes/js/LSsession_login.js @@ -4,6 +4,7 @@ var LSsession_login = new Class({ if ( ! this.select_ldapserver ) return; this.loading_zone = $('loading_zone'); + this.recoverPassword = $('LSsession_recoverPassword'); this.select_ldapserver.addEvent('change',this.onLdapServerChanged.bind(this)); this.onLdapServerChanged(); }, @@ -49,6 +50,12 @@ var LSsession_login = new Class({ else { this.loginformLevelHide(); } + if (data.recoverPassword) { + this.recoverPassword.removeClass('LSsession_recoverPassword_hidden'); + } + else { + this.recoverPassword.addClass('LSsession_recoverPassword_hidden'); + } } else { this.loginformLevelHide(); diff --git a/trunk/includes/js/LSsession_recoverPassword.js b/trunk/includes/js/LSsession_recoverPassword.js new file mode 100644 index 00000000..4c20cc43 --- /dev/null +++ b/trunk/includes/js/LSsession_recoverPassword.js @@ -0,0 +1,56 @@ +var LSsession_recoverPassword = new Class({ + initialize: function(){ + this.select_ldapserver = $('LSsession_ldapserver'); + if ( ! this.select_ldapserver ) + return; + this.loading_zone = $('loading_zone'); + this.select_ldapserver.addEvent('change',this.onLdapServerChanged.bind(this)); + this.onLdapServerChanged(); + }, + + disableInput: function() { + $$('input').each(function(el) { + el.setProperty('disabled','1'); + }); + }, + + enableInput: function() { + $$('input').each(function(el) { + el.setProperty('disabled',''); + }); + }, + + onLdapServerChanged: function(){ + this.disableInput(); + var imgload = varLSdefault.loadingImgDisplay(this.loading_zone,'inside','big'); + var server = this.select_ldapserver.value; + var data = { + template: 'recoverPassword', + action: 'onLdapServerChanged', + server: server, + imgload: imgload + }; + new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLdapServerChangedComplete.bind(this)}).send(); + }, + + onLdapServerChangedComplete: function(responseText, responseXML){ + varLSdefault.loadingImgHide(); + var data = JSON.decode(responseText); + LSdebug(data); + if ( varLSdefault.checkAjaxReturn(data) ) { + if (data.recoverPassword) { + this.enableInput(); + } + } + }, + + loginformLevelHide: function(){ + $$('.loginform-level').each(function(el) { + el.setStyle('display','none'); + }); + $('LSsession_topDn').empty(); + } +}); +window.addEvent(window.ie ? 'load' : 'domready', function() { + varLSsession_recoverPassword = new LSsession_recoverPassword(); +}); diff --git a/trunk/index_ajax.php b/trunk/index_ajax.php index 5271564b..e048e2e9 100644 --- a/trunk/index_ajax.php +++ b/trunk/index_ajax.php @@ -5,7 +5,7 @@ require_once 'includes/class/class.LSsession.php'; $GLOBALS['LSsession'] = new LSsession(); -if ($_REQUEST['template'] != 'login') { +if (($_REQUEST['template'] != 'login')&&($_REQUEST['template'] != 'recoverPassword')) { if ( !$GLOBALS['LSsession'] -> startLSsession() ) { $_ERRORS = 'LSsession : Impossible d\'initialiser la LSsession.'; } @@ -18,17 +18,26 @@ if (!isset($_ERRORS)) { case 'onLdapServerChanged': if ( isset($_REQUEST['server']) ) { $GLOBALS['LSsession'] -> setLdapServer($_REQUEST['server']); + $data = array(); if ( $GLOBALS['LSsession'] -> LSldapConnect() ) { session_start(); $list = $GLOBALS['LSsession'] -> getSubDnLdapServerOptions($_SESSION['LSsession_topDn']); if (is_string($list)) { - $list=""; - $data = array( - 'list_topDn' => $list, - 'levelLabel' => $GLOBALS['LSsession'] -> getLevelLabel() - ); + $data['list_topDn'] = ""; + $data['levelLabel'] = $GLOBALS['LSsession'] -> getLevelLabel(); } } + $data['recoverPassword'] = isset($GLOBALS['LSsession'] -> ldapServer['recoverPassword']); + } + break; + } + break; + case 'recoverPassword': + switch($_REQUEST['action']) { + case 'onLdapServerChanged': + if ( isset($_REQUEST['server']) ) { + $GLOBALS['LSsession'] -> setLdapServer($_REQUEST['server']); + $data=array('recoverPassword' => isset($GLOBALS['LSsession'] -> ldapServer['recoverPassword'])); } break; } diff --git a/trunk/templates/default/login.tpl b/trunk/templates/default/login.tpl index 3196337c..03c84370 100644 --- a/trunk/templates/default/login.tpl +++ b/trunk/templates/default/login.tpl @@ -35,7 +35,7 @@
-{$loginform_label_lostpassword} +{$loginform_label_recoverPassword} diff --git a/trunk/templates/default/recoverpassword.tpl b/trunk/templates/default/recoverpassword.tpl index e79951d4..31eebe3a 100644 --- a/trunk/templates/default/recoverpassword.tpl +++ b/trunk/templates/default/recoverpassword.tpl @@ -12,6 +12,7 @@
{$LSerrors}
+
{$LSinfos}
X
{if $LSdebug != ''}{$LSdebug}{/if}