Fix up action commands for user panel

This commit is contained in:
Brian Read 2024-12-16 19:55:15 +00:00
parent ff9a84dd29
commit 1d3d59b5c1

View File

@ -59,29 +59,67 @@
%= t td => (class => 'sme-border') => "$first $last" %= t td => (class => 'sme-border') => "$first $last"
%= t td => (class => 'sme-border') => $vpnaccess %= t td => (class => 'sme-border') => $vpnaccess
%= t td => (class => 'sme-border') => $fwd %= t td => (class => 'sme-border') => $fwd
% my ($actionModify, $actionLock, $actionResetPw, $actionRemove) = ' '; %my ($actionModify, $actionLock, $actionResetPw, $actionRemove) = ' ';
% if ($username eq 'admin') { %my $modify_text = l('MODIFY'); # Localized text
% $actionModify = "<a href='useraccountsd?CsrfDef=TOKEN&trt=UPS&user=" . $username . "'>" . "<button class='sme-modify-button' title=".l("MODIFY").">".l("MODIFY")."</button></a>"; %my $csrf_token = "TOKEN"; # CSRF token for security
% $actionResetPw = "<a href='useraccountsd?CsrfDef=TOKEN&trt=PWS&user=" . $username . "'>" . "<button class='sme-password-button' title=".l("Reset-Password").">".l("Reset-Password")."</button></a>"; %my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
% } else { %my $password_text = l("PASSWORD_RESET");
% $actionModify = "<a href='useraccountsd?CsrfDef=TOKEN&trt=UPD&user=" . $username . "'>" . "<button class='sme-modify-button' title=".l("MODIFY").">".l("MODIFY")."</button></a>"; %if ($username eq 'admin') {
% if ($password_set ne 'yes') { %$actionModify = qq{
% $actionLock = l('ACCOUNT_LOCKED'); % <button type='button' class='sme-modify-button' title='$modify_text'
% $actionResetPw = "<a href='useraccountsd?CsrfDef=TOKEN&trt=PWD&user=" . $username . "'>" . "<button class='sme-password-button' style ='border-color:red;' title=".l("Reset-Password").">".l("Reset-Password")."</button></a>"; % onclick="window.location.href='useraccountsd?CsrfDef=$csrf_token&trt=UPS&user=$useraccounts_user_name'">
% } else { % $modify_text
% $actionLock = "<a href='useraccountsd?CsrfDef=TOKEN&trt=LCK&user=" . $username . "'>" . "<button class='sme-lock-button' title=".l('usr_LOCK_ACCOUNT').">".l("usr_LOCK_ACCOUNT")."</button></a>"; % </button>
% $actionResetPw = "<a href='useraccountsd?CsrfDef=TOKEN&trt=PWD&user=" . $username . "'>" . "<button class='sme-password-button' title=".l("Reset-Password").">".l("Reset-Password")."</button></a>"; %};
% } %} else {
% if ( $removable eq 'yes' ) { %$actionModify = qq{
% $actionRemove = "<a href='useraccountsd?CsrfDef=TOKEN&trt=DEL&user=" . $username . "'>" . "<button class='sme-remove-button' title=".l("REMOVE").">".l("REMOVE")."</button></a>"; % <button type='button' class='sme-modify-button' title='$modify_text'
% } % onclick="window.location.href='useraccountsd?CsrfDef=$csrf_token&trt=UPD&user=$useraccounts_user_name'">
% } % $modify_text
% % </button>
% my $thisdomain = session 'SystemName'; %};
% $thisdomain .= ".".session 'DomainName'; %}
%# my $thisdomain = "localhost"; %if ($password_set ne 'yes') {
%$actionLock = l('ACCOUNT_LOCKED');
%$actionResetPw = qq{
% <button type='button' class='sme-password-button unset' title="$password_text - currently unset" style = background:pink;
% onclick="window.location.href='useraccountsd?CsrfDef=$csrf_token&trt=PWD&ibay=$useraccounts_user_name'">
% $password_text
% </button>
%};
%} else {
%my $lock_text = l('ACCOUNT LOCKED'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
%$actionLock = qq{
% <button type='button' class='sme-lock-button' title='$lock_text'
% onclick="window.location.href='useraccountsd?CsrfDef=$csrf_token&trt=LCK&user=$useraccounts_user_name'">
% $lock_text
% </button>
%};
%$actionResetPw = qq{
% <button type='button' class='sme-password-button' title='$password_text'
% onclick="window.location.href='useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name'">
% $password_text
% </button>
%};
%}
%if ( $removable eq 'yes' ) {
%my $remove_text = l('REMOVE'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%$actionRemove = qq{
% <button type='button' class='sme-remove-button' title='$remove_text'
% onclick="window.location.href='useraccountsd?CsrfDef=$csrf_token&trt=DEL&user=$useraccounts_user_name'">
% $remove_text
% </button>
%};
%}
<td class='sme-border' style="min-width:35em"> % my $thisdomain = session 'SystemName';
% $thisdomain .= ".".session 'DomainName';
%# my $thisdomain = "localhost";
<td class='sme-border' style="min-width:35em">
<%= $c->render_to_string(inline => $actionModify) %> <%= $c->render_to_string(inline => $actionModify) %>
<%= $c->render_to_string(inline => $actionResetPw) %> <%= $c->render_to_string(inline => $actionResetPw) %>
<%= $c->render_to_string(inline => $actionLock) %> <%= $c->render_to_string(inline => $actionLock) %>
@ -97,4 +135,4 @@
%= hidden_field 'trt' => $usr_datas->{trt} %= hidden_field 'trt' => $usr_datas->{trt}
</div> </div>