Compare commits

...

6 Commits

Author SHA1 Message Date
0dfbdf3d36 * Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-130.sme
- Adjust heading so that no white line under theme selector and move theme button in [SME: 13057]
2025-11-04 13:27:51 +00:00
820551b076 * Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-129.sme
- Useraccounts: Clean up forward email sub and make sure blank is errored  [SME: 13056]
2025-11-04 13:00:26 +00:00
1a37667a9c * Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-128.sme
- Move group table to under others in User accounts setup panel [SME: 13068]
2025-11-04 12:17:51 +00:00
c1aab3eb84 * Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-127.sme
- Move same var declations to outside innner scope [SME: 13073]
2025-11-04 11:44:27 +00:00
18442c0145 * Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-126.sme
- Remove debugging dump in portforwarding which crashes if no data  [SME: 13243]
2025-11-04 10:12:42 +00:00
5c227a2032 * Mon Nov 03 2025 Brian Read <brianr@koozali.org> 11.0.0-125.sme
- Arrange that Macaddress, InternalIP and comment cleared out when host entry switched to self [SME: 13207]
2025-11-03 11:34:55 +00:00
8 changed files with 89 additions and 39 deletions

View File

@@ -116,15 +116,38 @@ sub do_update {
$ndb = esmith::NetworksDB::UTF8->open || die "Couldn't open networks db";
my $notif = '';
my $result = '';
$hos_datas{'name'} = lc $c->param('Name');
$hos_datas{'domain'} = lc $c->param('Domain');
$hos_datas{'hostname'} = $c->param('Hostname');
$hos_datas{'comment'} = $c->param('Comment');
$hos_datas{'hosttype'} = $c->param('Hosttype');
$hos_datas{'internalip'} = $c->param('Internalip');
$hos_datas{'macaddress'} = $c->param('Macaddress');
$hos_datas{'externalip'} = $c->param('Externalip');
my $hostname = "$hos_datas{'name'}.$hos_datas{'domain'}";
# Fetch parameters with forced scalar context and default empty string if undefined
$hos_datas{'name'} = lc(scalar $c->param('Name') // '');
$hos_datas{'domain'} = lc(scalar $c->param('Domain') // '');
$hos_datas{'hostname'} = scalar $c->param('Hostname') // '';
$hos_datas{'comment'} = scalar $c->param('Comment') // '';
$hos_datas{'hosttype'} = scalar $c->param('Hosttype') // '';
$hos_datas{'internalip'} = scalar $c->param('Internalip') // '';
$hos_datas{'externalip'} = scalar $c->param('Externalip') // '';
my $hostname = "$hos_datas{'name'}.$hos_datas{'domain'}";
if (my $hostrec = $hdb->get($hostname)) {
my $hosttype = $hostrec->prop('HostType') // '';
#$c->app->log->info("$hosttype $hos_datas{'hosttype'} $hos_datas{'comment'} $hostrec->prop('Comment')");
# Clear comment if hosttype changes to 'self' and comment was not intentionally changed
if ($hosttype ne 'Self'
&& $hos_datas{'hosttype'} eq 'Self'
&& $hos_datas{'comment'} eq $hostrec->prop('Comment')) {
$hos_datas{'comment'} = '';
}
}
# Clear MAC address if hosttype is 'self', otherwise get from param
if ($hos_datas{'hosttype'} eq 'Self') {
$hos_datas{'macaddress'} = '';
$hos_datas{'internalip'} = '';
#$c->app->log->info("yes $hos_datas{'hosttype'} $hos_datas{'macaddress'}");
} else {
$hos_datas{'macaddress'} = scalar $c->param('Macaddress') // '';
#$c->app->log->info("no $hos_datas{'hosttype'} $hos_datas{'macaddress'}");
}
if ($trt eq 'ADD') {
$hos_datas{'hostname'} = $hostname;
@@ -521,4 +544,4 @@ sub must_be_local {
# Not OK. The IP is not on any of our local networks.
return $c->l('hos_ERR_IP_NOT_LOCAL');
} ## end sub must_be_local
1;
1;

View File

@@ -179,7 +179,7 @@ sub do_update {
$res = $c->pseudonym_clash($first);
$result .= $res unless $res eq 'OK';
if ($mail) {
if (defined $mail) {
$res = $c->emailforward($mail);
$result .= $res unless $res eq 'OK';
}
@@ -217,7 +217,7 @@ sub do_update {
$res = $c->pseudonym_clash($first);
$result .= $res unless $res eq 'OK';
if ($mail) {
if (defined $mail) {
$res = $c->emailforward($mail);
$result .= $res unless $res eq 'OK';
}
@@ -554,27 +554,31 @@ sub pseudonym_clash {
sub emailforward {
my ($c, $data) = @_;
my $response = $c->email_simple($data);
#$c->app->log->info("emailformward called with $data!");
if ($response eq "OK") {
return "OK";
} elsif ($data eq "") {
# Trim whitespace from $data
$data =~ s/^\s+|\s+$//g if defined $data;
# Blank is ok, only if we're not forwarding, which means that the
# EmailForward param must be set to 'local'.
# Check simple email validation first
return "OK" if $c->email_simple($data) eq "OK";
# If trimmed data is empty
if ($data eq "") {
my $email_forward = $c->param('EmailForward') || '';
$email_forward =~ s/^\s+|\s+$//g;
return 'OK' if $email_forward eq 'local';
return $c->l('usr_CANNOT_CONTAIN_WHITESPACE');
} else {
return $c->l('usr_CANNOT_CONTAIN_WHITESPACE')
if ($data =~ /\s+/);
}
# Permit a local address.
return "OK" if $data =~ /^[a-zA-Z][a-zA-Z0-9\._\-]*$/;
return $c->l('usr_UNACCEPTABLE_CHARS');
} ## end else [ if ($response eq "OK")]
} ## end sub emailforward
# Reject if $data contains any whitespace inside
return $c->l('usr_CANNOT_CONTAIN_WHITESPACE') if $data =~ /\s/;
# Allow local address pattern
return "OK" if $data =~ /^[a-zA-Z][a-zA-Z0-9._-]*$/;
# Otherwise reject for unacceptable chars
return $c->l('usr_UNACCEPTABLE_CHARS');
}
sub get_groups {
my ($c) = shift;

View File

@@ -518,4 +518,9 @@ div.roundcube #roundcube{
/* Center aligned */
margin-left: auto!important;
margin-right: auto;
}
table.incolumn {
margin:auto;
color:red;
}

View File

@@ -122,6 +122,7 @@
max-width: 100%;
position: relative;
margin: auto;
margin-top:-20px;
}
#header2 {
@@ -290,4 +291,8 @@ background-color: #e8f3e1;
}
.busy {
cursor: wait; /* Change the cursor to a 'wait' cursor */
}
#swt_theme {
margin-left:10px;
}

View File

@@ -35,13 +35,13 @@
% foreach my $group (@$groups)
% {
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $group_name = $group->key; # group name extracted from the data structure
<tr>
%= t td => ( class => 'sme-border' ) => $group->key
%= t td => ( class => 'sme-border' ) => $group->prop('Description')
<td class='sme-border' style="min-width:15em">
% my $modify_text = l('MODIFY'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $group_name = $group->key; # group name extracted from the data structure
% my $actionModify = qq{
% <a href="groups2?CsrfDef=$csrf_token&trt=UPD&group=$group_name"
% class="sme-modify-button unset ui-button ui-corner-all ui-widget ui-button-icon-only"
@@ -52,8 +52,6 @@
% </a>
% };
% my $remove_text = l('REMOVE'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $group_name = $group->key; # group name extracted from the data structure
% my $actionRemove = qq{
% <a href="groups2?CsrfDef=$csrf_token&trt=DEL&group=$group_name"
% class="sme-remove-button unset ui-button ui-corner-all ui-widget ui-button-icon-only"

View File

@@ -131,7 +131,7 @@
%= l 'usr_GROUP_MEMBERSHIPS'
</span>
<span class=data>
<table class="sme-border "><thead>
<table class="sme-border incolumn"><thead>
<tr><th class='sme-border'>
%= l 'usr_MEMBER'
</th><th class='sme-border'>
@@ -182,4 +182,4 @@
% end
</div>
</div>

View File

@@ -5,11 +5,8 @@
% if (config->{debug} == 1) {
<p>
%= dumper "<pf>" . $c->current_route
%= dumper $c->stash("ret")
%= dumper $c->stash("portforwarding")
% my $ref = $pf_datas->{portforwarding};
%= dumper $ref->{TCP}->[0] . "</pf>"
%= dumper $c->current_route
%= dumper $pf_datas
</p>
% }
@@ -29,4 +26,4 @@
% }
</div>
% end
% end

View File

@@ -2,7 +2,7 @@ Summary: Sme Server Configuration : Manager 2
%define name smeserver-manager
Name: %{name}
%define version 11.0.0
%define release 124
%define release 130
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@@ -147,6 +147,24 @@ true
%defattr(-,root,root)
%changelog
* Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-130.sme
- Adjust heading so that no white line under theme selector and move theme button in [SME: 13057]
* Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-129.sme
- Useraccounts: Clean up forward email sub and make sure blank is errored [SME: 13056]
* Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-128.sme
- Move group table to under others in User accounts setup panel [SME: 13068]
* Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-127.sme
- Group panel: Move same var declations to outside innner scope [SME: 13073]
* Tue Nov 04 2025 Brian Read <brianr@koozali.org> 11.0.0-126.sme
- Remove debugging dump in portforwarding which crashes if no data [SME: 13243]
* Mon Nov 03 2025 Brian Read <brianr@koozali.org> 11.0.0-125.sme
- Arrange that Macaddress, InternalIP and comment cleared out when host entry switched to self [SME: 13207]
* Fri Oct 24 2025 Brian Read <brianr@koozali.org> 11.0.0-124.sme
- Adjust CSS for logout button to remove overlap of border and rounding [SME: 13247]