mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-26 19:54:46 +01:00
Improve login and recover password templates
This commit is contained in:
parent
b9477a8503
commit
cd8908391d
3 changed files with 36 additions and 77 deletions
|
@ -602,10 +602,10 @@ class LSsession {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['LSsession_recoverPassword'])) {
|
if (isset($_GET['LSsession_recoverPassword'])) {
|
||||||
$recoveryPasswordInfos = self :: recoverPasswd(
|
$recoveryPasswordInfos = self :: recoverPasswd (
|
||||||
$_REQUEST['LSsession_user'],
|
(isset($_REQUEST['LSsession_user'])?$_REQUEST['LSsession_user']:''),
|
||||||
$_GET['recoveryHash']
|
(isset($_GET['recoveryHash'])?$_GET['recoveryHash']:'')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$LSuserObject = LSauth :: forceAuthentication();
|
$LSuserObject = LSauth :: forceAuthentication();
|
||||||
|
@ -778,18 +778,10 @@ class LSsession {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($step==1) {
|
if ($step==1) {
|
||||||
if ($_SERVER['HTTPS']=='on') {
|
|
||||||
$recovery_url='https://';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$recovery_url='http://';
|
|
||||||
}
|
|
||||||
$recovery_url .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'&recoveryHash='.$info;
|
|
||||||
|
|
||||||
$subject = self :: $ldapServer['recoverPassword']['recoveryHashMail']['subject'];
|
$subject = self :: $ldapServer['recoverPassword']['recoveryHashMail']['subject'];
|
||||||
$msg = getFData(
|
$msg = getFData(
|
||||||
self :: $ldapServer['recoverPassword']['recoveryHashMail']['msg'],
|
self :: $ldapServer['recoverPassword']['recoveryHashMail']['msg'],
|
||||||
$recovery_url
|
LSurl :: get_public_absolute_url('index')."?LSsession_recoverPassword&recoveryHash=$info"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1200,32 +1192,12 @@ class LSsession {
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
public static function displayLoginForm() {
|
public static function displayLoginForm() {
|
||||||
LStemplate :: assign('pagetitle',_('Connection'));
|
LStemplate :: assign('pagetitle', _('Connection'));
|
||||||
if (isset($_GET['LSsession_logout'])) {
|
$ldapservers = array();
|
||||||
LStemplate :: assign('loginform_action', '');
|
foreach(LSconfig :: get('ldap_servers') as $id => $infos)
|
||||||
}
|
$ldapservers[$id] = __($infos['name']);
|
||||||
else {
|
LStemplate :: assign('ldapservers', $ldapservers);
|
||||||
LStemplate :: assign('loginform_action',$_SERVER['REQUEST_URI']);
|
LStemplate :: assign('ldapServerId', (self :: $ldapServerId?self :: $ldapServerId:0));
|
||||||
}
|
|
||||||
if (count(LSconfig :: get('ldap_servers'))==1) {
|
|
||||||
LStemplate :: assign('loginform_ldapserver_style','style="display: none"');
|
|
||||||
}
|
|
||||||
LStemplate :: assign('loginform_label_ldapserver',_('LDAP server'));
|
|
||||||
$ldapservers_name=array();
|
|
||||||
$ldapservers_index=array();
|
|
||||||
foreach(LSconfig :: get('ldap_servers') as $id => $infos) {
|
|
||||||
$ldapservers_index[]=$id;
|
|
||||||
$ldapservers_name[]=__($infos['name']);
|
|
||||||
}
|
|
||||||
LStemplate :: assign('loginform_ldapservers_name',$ldapservers_name);
|
|
||||||
LStemplate :: assign('loginform_ldapservers_index',$ldapservers_index);
|
|
||||||
|
|
||||||
LStemplate :: assign('loginform_label_level',_('Level'));
|
|
||||||
LStemplate :: assign('loginform_label_user',_('Identifier'));
|
|
||||||
LStemplate :: assign('loginform_label_pwd',_('Password'));
|
|
||||||
LStemplate :: assign('loginform_label_submit',_('Connect'));
|
|
||||||
LStemplate :: assign('loginform_label_recoverPassword',_('Forgot your password ?'));
|
|
||||||
|
|
||||||
self :: setTemplate('login.tpl');
|
self :: setTemplate('login.tpl');
|
||||||
self :: addJSscript('LSsession_login.js');
|
self :: addJSscript('LSsession_login.js');
|
||||||
}
|
}
|
||||||
|
@ -1242,26 +1214,13 @@ class LSsession {
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
public static function displayRecoverPasswordForm($recoveryPasswordInfos) {
|
public static function displayRecoverPasswordForm($recoveryPasswordInfos) {
|
||||||
LStemplate :: assign('pagetitle',_('Recovery of your credentials'));
|
LStemplate :: assign('pagetitle', _('Recovery of your credentials'));
|
||||||
LStemplate :: assign('recoverpasswordform_action','?LSsession_recoverPassword');
|
|
||||||
|
|
||||||
if (count(LSconfig :: get('ldap_servers'))==1) {
|
$ldapservers = array();
|
||||||
LStemplate :: assign('recoverpasswordform_ldapserver_style','style="display: none"');
|
foreach(LSconfig :: get('ldap_servers') as $id => $infos)
|
||||||
}
|
$ldapservers[$id] = __($infos['name']);
|
||||||
|
LStemplate :: assign('ldapservers', $ldapservers);
|
||||||
LStemplate :: assign('recoverpasswordform_label_ldapserver',_('LDAP server'));
|
LStemplate :: assign('ldapServerId', (self :: $ldapServerId?self :: $ldapServerId:0));
|
||||||
$ldapservers_name=array();
|
|
||||||
$ldapservers_index=array();
|
|
||||||
foreach(LSconfig :: get('ldap_servers') as $id => $infos) {
|
|
||||||
$ldapservers_index[]=$id;
|
|
||||||
$ldapservers_name[]=$infos['name'];
|
|
||||||
}
|
|
||||||
LStemplate :: assign('recoverpasswordform_ldapservers_name',$ldapservers_name);
|
|
||||||
LStemplate :: assign('recoverpasswordform_ldapservers_index',$ldapservers_index);
|
|
||||||
|
|
||||||
LStemplate :: assign('recoverpasswordform_label_user',_('Identifier'));
|
|
||||||
LStemplate :: assign('recoverpasswordform_label_submit',_('Validate'));
|
|
||||||
LStemplate :: assign('recoverpasswordform_label_back',_('Back'));
|
|
||||||
|
|
||||||
$recoverpassword_step = 'start';
|
$recoverpassword_step = 'start';
|
||||||
$recoverpassword_msg = _('Please fill the identifier field to proceed recovery procedure');
|
$recoverpassword_msg = _('Please fill the identifier field to proceed recovery procedure');
|
||||||
|
@ -1283,8 +1242,8 @@ class LSsession {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
LStemplate :: assign('recoverpassword_step',$recoverpassword_step);
|
LStemplate :: assign('recoverpassword_step', $recoverpassword_step);
|
||||||
LStemplate :: assign('recoverpassword_msg',$recoverpassword_msg);
|
LStemplate :: assign('recoverpassword_msg', $recoverpassword_msg);
|
||||||
|
|
||||||
self :: setTemplate('recoverpassword.tpl');
|
self :: setTemplate('recoverpassword.tpl');
|
||||||
self :: addJSscript('LSsession_recoverPassword.js');
|
self :: addJSscript('LSsession_recoverPassword.js');
|
||||||
|
|
|
@ -16,17 +16,17 @@
|
||||||
<div class='loginform'>
|
<div class='loginform'>
|
||||||
<img src='{img name='logo'}' alt='Logo' id='loginform_logo' />
|
<img src='{img name='logo'}' alt='Logo' id='loginform_logo' />
|
||||||
<div id='loading_zone'></div>
|
<div id='loading_zone'></div>
|
||||||
<form action='{$loginform_action}' method='post'>
|
<form action='{if $request->current_url}{$request->current_url}{else}index{/if}' method='post'>
|
||||||
<dl class='loginform'>
|
<dl class='loginform'>
|
||||||
<dt {$loginform_ldapserver_style}>{$loginform_label_ldapserver|escape:"htmlall"}</dt>
|
<dt {if count($ldapservers) <= 1}style="display: none"{/if}>{tr msg="LDAP server"}</dt>
|
||||||
<dd {$loginform_ldapserver_style}>
|
<dd {if count($ldapservers) <= 1}style="display: none"{/if}>
|
||||||
<select name='LSsession_ldapserver' id='LSsession_ldapserver'>{html_options values=$loginform_ldapservers_index output=$loginform_ldapservers_name selected=$ldapServerId}</select>
|
<select name='LSsession_ldapserver' id='LSsession_ldapserver'>{html_options options=$ldapservers selected=$ldapServerId}</select>
|
||||||
</dd>
|
</dd>
|
||||||
<dt class='loginform-level' id='LSsession_topDn_label' {$loginform_ldapserver_style}>{$loginform_label_level|escape:"htmlall"}</dt>
|
<dt class='loginform-level' id='LSsession_topDn_label' {if count($ldapservers) <= 1}style="display: none"{/if}>{tr msg="Level"}</dt>
|
||||||
<dd class='loginform-level' {$loginform_ldapserver_style}><select name='LSsession_topDn' id='LSsession_topDn'>{html_options values=$loginform_topdn_index output=$loginform_topdn_name selected=$topDn}</select></dd>
|
<dd class='loginform-level' {if count($ldapservers) <= 1}style="display: none"{/if}><select name='LSsession_topDn' id='LSsession_topDn'></select></dd>
|
||||||
<dt>{$loginform_label_user|escape:"htmlall"}</dt>
|
<dt>{tr msg="Identifier"}</dt>
|
||||||
<dd><input type='text' name='LSauth_user' /></dd>
|
<dd><input type='text' name='LSauth_user' /></dd>
|
||||||
<dt>{$loginform_label_pwd|escape:"htmlall"}</dt>
|
<dt>{tr msg="Password"}</dt>
|
||||||
<dd><input type='password' name='LSauth_pwd' /></dd>
|
<dd><input type='password' name='LSauth_pwd' /></dd>
|
||||||
<dt class='LSlang_hidden'>{tr msg="Language"}</dt>
|
<dt class='LSlang_hidden'>{tr msg="Language"}</dt>
|
||||||
<dd class='LSlang_hidden'>
|
<dd class='LSlang_hidden'>
|
||||||
|
@ -36,11 +36,11 @@
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</dd>
|
</dd>
|
||||||
<dd><input type='submit' value='{$loginform_label_submit|escape:"htmlall"}' /></dd>
|
<dd><input type='submit' value='{tr msg="Connect"|escape:"quotes"}' /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
<span>{tr msg="Language"} : <img id='LSlang' src='{img name=$LSlang}' alt='{$LSlang|escape:"htmlall"}' title='{$LSlang|escape:"htmlall"}'/></span>
|
<span>{tr msg="Language"} : <img id='LSlang' src='{img name=$LSlang}' alt='{$LSlang|escape:"htmlall"}' title='{$LSlang|escape:"htmlall"}'/></span>
|
||||||
<a href='?LSsession_recoverPassword' class='LSsession_recoverPassword LSsession_recoverPassword_hidden'>{$loginform_label_recoverPassword|escape:"htmlall"}</a>
|
<a href='?LSsession_recoverPassword' class='LSsession_recoverPassword LSsession_recoverPassword_hidden'>{tr msg="Forgot your password ?"}</a>
|
||||||
</div>
|
</div>
|
||||||
{include file='ls:LSsession_js.tpl'}
|
{include file='ls:LSsession_js.tpl'}
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -16,22 +16,22 @@
|
||||||
<img src='{img name='logo'}' alt='Logo' id='recoverpasswordform_logo' />
|
<img src='{img name='logo'}' alt='Logo' id='recoverpasswordform_logo' />
|
||||||
<div id='loading_zone'></div>
|
<div id='loading_zone'></div>
|
||||||
{if $recoverpassword_step == 'start'}
|
{if $recoverpassword_step == 'start'}
|
||||||
<form action='{$recoverpasswordform_action}' method='post'>
|
<form action='index?LSsession_recoverPassword' method='post'>
|
||||||
<dl class='recoverpasswordform'>
|
<dl class='recoverpasswordform'>
|
||||||
<dt {$recoverpasswordform_ldapserver_style}>{$recoverpasswordform_label_ldapserver|escape:"htmlall"}</dt>
|
<dt {if count($ldapservers) <= 1}style="display: none"{/if}>{tr msg="LDAP server"}</dt>
|
||||||
<dd {$recoverpasswordform_ldapserver_style}>
|
<dd {if count($ldapservers) <= 1}style="display: none"{/if}>
|
||||||
<select name='LSsession_ldapserver' id='LSsession_ldapserver'>{html_options values=$recoverpasswordform_ldapservers_index output=$recoverpasswordform_ldapservers_name selected=$ldapServerId}</select>
|
<select name='LSsession_ldapserver' id='LSsession_ldapserver'>{html_options options=$ldapservers selected=$ldapServerId}</select>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>{$recoverpasswordform_label_user|escape:"htmlall"}</dt>
|
<dt>{tr msg="Identifier"}</dt>
|
||||||
<dd><input type='text' name='LSsession_user' /></dd>
|
<dd><input type='text' name='LSsession_user' /></dd>
|
||||||
<dd><input type='submit' value='{$recoverpasswordform_label_submit|escape:"htmlall"}' /></dd>
|
<dd><input type='submit' value='{tr msg="Validate"|escape:"quotes"}' /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<p id='recoverpassword_msg'>{$recoverpassword_msg|escape:"htmlall"}</p>
|
<p id='recoverpassword_msg'>{$recoverpassword_msg|escape:"htmlall"}</p>
|
||||||
<span>{tr msg="Language"} : <img id='LSlang' src='{img name=$LSlang}' alt='{$LSlang|escape:"htmlall"}' title='{$LSlang|escape:"htmlall"}'/></span>
|
<span>{tr msg="Language"} : <img id='LSlang' src='{img name=$LSlang}' alt='{$LSlang|escape:"htmlall"}' title='{$LSlang|escape:"htmlall"}'/></span>
|
||||||
<a href='' id='recoverpassword_back'>{$recoverpasswordform_label_back|escape:"htmlall"}</a>
|
<a href='' id='recoverpassword_back'>{tr msg="Back"}</a>
|
||||||
</div>
|
</div>
|
||||||
{include file='ls:LSsession_js.tpl'}
|
{include file='ls:LSsession_js.tpl'}
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue