Skip to content

Commit

Permalink
Display if account is valid or not
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot committed Nov 19, 2024
1 parent 9b82c8b commit 7c287fb
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
3 changes: 3 additions & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@
$use_disablecomment = false;
$use_disablecomment_required = false;

$show_validitystatus = true;
$use_updatestarttime = true;
$use_updateendtime = true;

# Local password policy
# This is applied before directory password policy
Expand Down
6 changes: 6 additions & 0 deletions htdocs/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$canLockAccount="";
$isAccountEnabled = "";
$lockDate = "";
$isAccountValid = "";

if (isset($_GET["dn"]) and $_GET["dn"]) {
$dn = $_GET["dn"];
Expand Down Expand Up @@ -161,6 +162,10 @@
$isAccountEnabled = $directory->isAccountEnabled($ldap, $dn);
}

if ($show_validitystatus) {
$isAccountValid = $directory->isAccountValid($ldap, $dn);
}

}}}
}

Expand Down Expand Up @@ -194,5 +199,6 @@
} else {
$smarty->assign('msg_resetpasswordresult','');
}
$smarty->assign("isAccountValid", $isAccountValid);

?>
4 changes: 3 additions & 1 deletion htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ function sha256($string)
$smarty->assign('use_enablecomment_required',$use_enablecomment_required);
$smarty->assign('use_disablecomment',$use_disablecomment);
$smarty->assign('use_disablecomment_required',$use_disablecomment_required);

$smarty->assign('show_validitystatus',$show_validitystatus);
$smarty->assign('use_updatestarttime',$attributes_map['starttime'] ? $use_updatestarttime : false);
$smarty->assign('use_updateendtime',$attributes_map['endtime'] ? $use_updateendtime : false);

# Assign messages
$smarty->assign('lang',$lang);
Expand Down
2 changes: 2 additions & 0 deletions lang/en.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
$messages['accountnotenabled'] = "Fail to enable account";
$messages['accountnotlocked'] = "Fail to lock account";
$messages['accountnotunlocked'] = "Fail to unlock account";
$messages['accountnotvalid'] = "Account is not valid";
$messages['accountunlocked'] = "Account is not locked";
$messages['accountstatus'] = "Account status";
$messages['accountvalid'] = "Account is valid";
$messages['actionforbidden'] = "Action forbidden";
$messages['changesubject'] = "Your password has been changed";
$messages['changesubjectforadmin'] = "User password has been changed";
Expand Down
2 changes: 2 additions & 0 deletions lang/fr.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
$messages['accountnotenabled'] = "Échec de l'activation du compte";
$messages['accountnotlocked'] = "Échec de verrouillage du compte";
$messages['accountnotunlocked'] = "Échec de déverrouillage du compte";
$messages['accountnotvalid'] = "Le compte n'est pas valide";
$messages['accountstatus'] = "Statut du compte";
$messages['accountunlocked'] = "Le compte n'est pas verrouillé";
$messages['accountvalid'] = "Le compte est valide";
$messages['actionforbidden'] = "Action interdite";
$messages['changesubject'] = "Votre mot de passe a été changé";
$messages['changesubjectforadmin'] = "Le mot de passe d'un utilisateur a été changé";
Expand Down
26 changes: 24 additions & 2 deletions templates/display.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,30 @@
</div>
{/if}
</div>
{/if}
{/if}
{/if}
{/if}

{if $show_validitystatus}
{if $isAccountValid}
<div class="card mb-3 shadow border-success">
<div class="card-header text-bg-success text-center">
<p class="card-title">
<i class="fa fa-fw fa-check-square-o"></i>
{$msg_accountvalid}
</p>
</div>
</div>
{else}
<div class="card mb-3 shadow border-danger">
<div class="card-header text-bg-danger text-center">
<p class="card-title">
<i class="fa fa-fw fa-exclamation-triangle"></i>
{$msg_accountnotvalid}
</p>
</div>
</div>
{/if}
{/if}

</div>
</div>

0 comments on commit 7c287fb

Please sign in to comment.