162 lines
7.5 KiB
Plaintext
162 lines
7.5 KiB
Plaintext
<div>
|
|
|
|
% my $btn = l("usr_ADD_USER");
|
|
|
|
<form action="/smanager/useraccounts" method="POST">
|
|
<br>
|
|
<div>
|
|
<button type="submit" class="btn btn-primary btn-sm"><%= $btn %> </button>
|
|
</div>
|
|
</form>
|
|
|
|
<br>
|
|
<%= $c->render_to_string(inline => $c->l("usr_FIRSTPAGE_DESC")) %>
|
|
<br>
|
|
|
|
%#= dumper @$users
|
|
|
|
% my $numUsers = @$users;
|
|
% if ($numUsers == 0) {
|
|
<%=l "usr_NO_USER_ACCOUNTS" %>
|
|
% } else {
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th><%= l "ACCOUNT" %></th>
|
|
<th><%= l "USER_NAME" %></th>
|
|
<th><%= l "usr_VPN_CLIENT_ACCESS" %></th>
|
|
<th><%= l "usr_FORWARDING_ADDRESS" %></th>
|
|
<th class="text-center text-center" colspan="5"><%= l "ACTION" %></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
% foreach my $user (@$users) {
|
|
|
|
% my $username = $user->key();
|
|
% my $first = $user->prop("FirstName");
|
|
% my $last = $user->prop("LastName");
|
|
% my $lockable = $user->prop("Lockable") || "yes";
|
|
% my $removable = $user->prop("Removable") || "yes";
|
|
% my $fwd = (($user->prop("EmailForward") || "local") =~ m/^forward|both$/) ?
|
|
% $user->prop("ForwardAddress") : "";
|
|
% my $vpnaccess = $user->prop("VPNClientAccess") || "no";
|
|
% $vpnaccess = $vpnaccess eq "yes" ? $c->l("YES") : $c->l("NO");
|
|
% my $password_set = $user->prop("PasswordSet");
|
|
% my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
|
|
% my $csrf_token = "TOKEN"; # CSRF token for security
|
|
% my $modify_text = l("MODIFY"); # Localized text
|
|
% my $remove_text = l("REMOVE"); # Localized text
|
|
% my $password_text = l("PASSWORD_RESET");
|
|
% my $lock_text = l("Lock"); # Localized text
|
|
% my $roundcube_text = l("Webmail"); # Localized text
|
|
% my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = " ";
|
|
% my $thisdomain = $c->req->url->to_abs->host;
|
|
|
|
<tr class="align-middle">
|
|
<td><%= $username %></td>
|
|
<td><%= $first %> <%=$last %></td>
|
|
<td><%= $vpnaccess %></td>
|
|
<td><%= $fwd %></td>
|
|
|
|
% if ($useraccounts_user_name eq "admin") {
|
|
%$actionModify = qq{
|
|
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPS&user=$useraccounts_user_name">
|
|
% <button type="button" class="btn btn-primary btn-sm" title="$modify_text">
|
|
% $modify_text
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
%$actionResetPw = qq{
|
|
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWS&user=$useraccounts_user_name">
|
|
% <button type="button" class="btn btn-primary btn-sm" title="$password_text" >
|
|
% $password_text
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
% } else {
|
|
%$actionModify = qq{
|
|
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPD&user=$useraccounts_user_name">
|
|
% <button type="button" class="btn btn-primary btn-sm" title="$modify_text" >
|
|
% $modify_text
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
% }
|
|
|
|
|
|
% if ($password_set ne "yes") {
|
|
|
|
<!-- Needs a fix here -->
|
|
%#$actionLock = l("ACCOUNT_LOCKED");
|
|
<!-- Sets BOTH columns - possibly leave out Reset Password here?-->
|
|
%$actionLock = qq{
|
|
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
|
|
% <button type="button" class="btn btn-danger btn-sm" title="$password_text - currently unset">
|
|
% Unlock
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
%$actionResetPw = qq{
|
|
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
|
|
% <button type="button" class="btn btn-primary btn-sm" title="$password_text - currently unset">
|
|
% $password_text
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
|
|
% } elsif ($useraccounts_user_name ne "admin") {
|
|
%$actionLock = qq{
|
|
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=LCK&user=$useraccounts_user_name">
|
|
% <button type="button" class="btn btn-primary btn-sm" title="$lock_text" >
|
|
% $lock_text
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
%$actionResetPw = qq{
|
|
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
|
|
% <button type="button" class="btn btn-primary btn-sm" title="$password_text" >
|
|
% $password_text
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
% }
|
|
|
|
% if ( $removable eq "yes" ) {
|
|
%$actionRemove = qq{
|
|
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=DEL&user=$useraccounts_user_name">
|
|
% <button type="button" class="btn btn-primary btn-sm" title="$remove_text" >
|
|
% $remove_text
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
% }
|
|
|
|
<!-- If webmail disabled??? -->
|
|
% $actionroundcube = qq{
|
|
%<a href="roundcubepanel?CsrfDef=$csrf_token&url=https://$thisdomain/roundcube?_user=$useraccounts_user_name&height=600px">
|
|
% <button type="button" class="btn btn-primary btn-sm" title="$roundcube_text" >
|
|
% $roundcube_text
|
|
% </button>
|
|
%</a>
|
|
%};
|
|
|
|
<td class="text-center"><%= $c->render_to_string(inline => $actionModify) %></td>
|
|
<td class="text-center"><%= $c->render_to_string(inline => $actionResetPw) %></td>
|
|
<td class="text-center"><%= $c->render_to_string(inline => $actionLock) %></td>
|
|
<td class="text-center"><%= $c->render_to_string(inline => $actionRemove) %></td>
|
|
<td class="text-center"><%= $c->render_to_string(inline => $actionroundcube) %></td>
|
|
</tr>
|
|
% }
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
% }
|
|
|
|
<%= hidden_field "trt" => $usr_datas->{trt} %>
|
|
|
|
</div>
|
|
|