mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
- LSsession_login && LSsession_recoverPassword :
-> Activation/Desactivation de la possibilite du recoverPassword en fonction du serveur selectionne
This commit is contained in:
parent
6710a1a51f
commit
380df2166a
8 changed files with 92 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
56
trunk/includes/js/LSsession_recoverPassword.js
Normal file
56
trunk/includes/js/LSsession_recoverPassword.js
Normal file
|
@ -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();
|
||||
});
|
|
@ -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="<select name='LSsession_topDn' id='LSsession_topDn'>".$list."</select>";
|
||||
$data = array(
|
||||
'list_topDn' => $list,
|
||||
'levelLabel' => $GLOBALS['LSsession'] -> getLevelLabel()
|
||||
);
|
||||
$data['list_topDn'] = "<select name='LSsession_topDn' id='LSsession_topDn'>".$list."</select>";
|
||||
$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;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<dd><input type='submit' value='{$loginform_label_submit}' /></dd>
|
||||
</dl>
|
||||
</form>
|
||||
<a href='index.php?LSsession_recoverPassword' id='LSsession_lostPassword'>{$loginform_label_lostpassword}</a>
|
||||
<a href='index.php?LSsession_recoverPassword' id='LSsession_recoverPassword'>{$loginform_label_recoverPassword}</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<div id='LSerror'>
|
||||
{$LSerrors}
|
||||
</div>
|
||||
<div id='LSinfos'>{$LSinfos}</div>
|
||||
<div id='LSdebug'>
|
||||
<a href='#' id='LSdebug_hidden'>X</a>
|
||||
<div id='LSdebug_infos'>{if $LSdebug != ''}{$LSdebug}{/if}</div>
|
||||
|
|
Loading…
Reference in a new issue