Skip to content

Commit

Permalink
ltb-project#127: Added feature to enable and disable comment. Added d…
Browse files Browse the repository at this point in the history
…ocumentation for the feature.
  • Loading branch information
abpai94 committed Jul 22, 2024
1 parent e3b2e42 commit d765861
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 16 deletions.
2 changes: 2 additions & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@
$resetpassword_reset_default = true;
$show_lockstatus = true;
$use_unlockaccount = true;
$use_unlockcomment = false;
$use_lockaccount = true;
$use_lockcomment = false;
$show_expirestatus = true;
$use_searchlocked = true;
$use_searchexpired = true;
Expand Down
Binary file added docs/images/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/ltb-insert-comment.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions docs/lockaccount.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,17 @@ To enable this feature:
.. code-block:: php
$use_unlockaccount = true;
Insert comment
--------------

A feature to enable comments when locking and unlocking user accounts can be enabled.

.. image:: images/ltb-insert-comment.jpg

To enable this feature:

.. code-block:: php
$use_lockcomment = true;
$use_unlockcomment = true;
2 changes: 2 additions & 0 deletions htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
$smarty->assign('resetpassword_reset_default',$resetpassword_reset_default);
$smarty->assign('show_lockstatus',$show_lockstatus);
$smarty->assign('use_unlockaccount',$use_unlockaccount);
$smarty->assign('use_unlockcomment',$use_unlockcomment);
$smarty->assign('use_lockaccount',$use_lockaccount);
$smarty->assign('use_lockcomment',$use_lockcomment);
$smarty->assign('show_expirestatus',$show_expirestatus);
$smarty->assign('display_password_expiration_date',$display_password_expiration_date);
$smarty->assign('use_searchlocked',$use_searchlocked);
Expand Down
7 changes: 6 additions & 1 deletion htdocs/lockaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$result = "";
$dn = "";
$password = "";
$comment = $_POST["comment"];
$comment = "";

if (isset($_POST["dn"]) and $_POST["dn"]) {
$dn = $_POST["dn"];
Expand Down Expand Up @@ -73,6 +73,11 @@
}
}


if (isset($_POST["comment"])) {
$comment = $_POST["comment"];
}

if ($audit_log_file) {
auditlog($audit_log_file, $dn, $audit_admin, "lockaccount", $result, $comment);
}
Expand Down
6 changes: 5 additions & 1 deletion htdocs/unlockaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$dn = "";
$password = "";
$returnto = "display";
$comment = $_POST["comment"];
$comment = "";

if (isset($_POST["dn"]) and $_POST["dn"]) {
$dn = $_POST["dn"];
Expand Down Expand Up @@ -43,6 +43,10 @@
}
}

if (isset($_POST["comment"])) {
$comment = $_POST["comment"];
}

if ($audit_log_file) {
auditlog($audit_log_file, $dn, $audit_admin, "unlockaccount", $result, $comment);
}
Expand Down
45 changes: 31 additions & 14 deletions templates/display.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,22 @@
{if $unlockaccountresult eq 'ldaperror'}
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotunlocked}</div>
{/if}
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#commentModal">
<i class="fa fa-fw fa-unlock"></i> {$msg_unlockaccount}
</button>
<div>
{include 'comment.tpl' method=unlock page=unlockaccount}
</div>
{/if}
{if $use_unlockcomment}
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#commentModal">
<i class="fa fa-fw fa-unlock"></i> {$msg_unlockaccount}
</button>
<div>
{include 'comment.tpl' method=unlock page=unlockaccount}
</div>
{else}
<form id="unlockaccount" method="post" action="index.php?page=unlockaccount">
<input type="hidden" name="dn" value="{$dn}" />
<button type="submit" class="btn btn-success">
<i class="fa fa-fw fa-unlock"></i> {$msg_unlockaccount}
</button>
</form>
{/if}
{/if}
</div>
</div>
{/if}
Expand All @@ -236,13 +245,21 @@
{if $lockaccountresult eq 'ldaperror'}
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotlocked}</div>
{/if}
<input type="hidden" name="dn" value="{$dn}" />
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#commentModal">
<i class="fa fa-fw fa-lock"></i> {$msg_lockaccount}
</button>
<div>
{include 'comment.tpl' method=lock page=lockaccount}
</div>
{if $use_lockcomment}
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#commentModal">
<i class="fa fa-fw fa-lock"></i> {$msg_lockaccount}
</button>
<div>
{include 'comment.tpl' method=lock page=lockaccount}
</div>
{else}
<form id="lockaccount" method="post" action="index.php?page=lockaccount">
<input type="hidden" name="dn" value="{$dn}" />
<button type="submit" class="btn btn-success">
<i class="fa fa-fw fa-lock"></i> {$msg_lockaccount}
</button>
</form>
{/if}
</div>
{/if}
</div>
Expand Down

0 comments on commit d765861

Please sign in to comment.