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

@ -60,23 +60,61 @@
%= 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) = ' ';
%my $modify_text = l('MODIFY'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
%my $password_text = l("PASSWORD_RESET");
%if ($username eq 'admin') { %if ($username eq 'admin') {
% $actionModify = "<a href='useraccountsd?CsrfDef=TOKEN&trt=UPS&user=" . $username . "'>" . "<button class='sme-modify-button' title=".l("MODIFY").">".l("MODIFY")."</button></a>"; %$actionModify = qq{
% $actionResetPw = "<a href='useraccountsd?CsrfDef=TOKEN&trt=PWS&user=" . $username . "'>" . "<button class='sme-password-button' title=".l("Reset-Password").">".l("Reset-Password")."</button></a>"; % <button type='button' class='sme-modify-button' title='$modify_text'
% onclick="window.location.href='useraccountsd?CsrfDef=$csrf_token&trt=UPS&user=$useraccounts_user_name'">
% $modify_text
% </button>
%};
%} else { %} else {
% $actionModify = "<a href='useraccountsd?CsrfDef=TOKEN&trt=UPD&user=" . $username . "'>" . "<button class='sme-modify-button' title=".l("MODIFY").">".l("MODIFY")."</button></a>"; %$actionModify = qq{
% <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>
%};
%}
%if ($password_set ne 'yes') { %if ($password_set ne 'yes') {
%$actionLock = l('ACCOUNT_LOCKED'); %$actionLock = l('ACCOUNT_LOCKED');
% $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>"; %$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 { %} else {
% $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>"; %my $lock_text = l('ACCOUNT LOCKED'); # Localized text
% $actionResetPw = "<a href='useraccountsd?CsrfDef=TOKEN&trt=PWD&user=" . $username . "'>" . "<button class='sme-password-button' title=".l("Reset-Password").">".l("Reset-Password")."</button></a>"; %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' ) { %if ( $removable eq 'yes' ) {
% $actionRemove = "<a href='useraccountsd?CsrfDef=TOKEN&trt=DEL&user=" . $username . "'>" . "<button class='sme-remove-button' title=".l("REMOVE").">".l("REMOVE")."</button></a>"; %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>
%};
%} %}
% }
%
% my $thisdomain = session 'SystemName'; % my $thisdomain = session 'SystemName';
% $thisdomain .= ".".session 'DomainName'; % $thisdomain .= ".".session 'DomainName';
%# my $thisdomain = "localhost"; %# my $thisdomain = "localhost";