aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Fripost/Panel/Interface.pm2
-rw-r--r--lib/Fripost/Schema/Domain.pm23
-rw-r--r--lib/Fripost/Schema/Util.pm4
-rw-r--r--templates/add-domain-1.html2
-rw-r--r--templates/add-domain-2.html2
-rw-r--r--templates/edit-domain.html2
-rw-r--r--templates/list-domains.html4
7 files changed, 20 insertions, 19 deletions
diff --git a/lib/Fripost/Panel/Interface.pm b/lib/Fripost/Panel/Interface.pm
index 79b77aa..fc27158 100644
--- a/lib/Fripost/Panel/Interface.pm
+++ b/lib/Fripost/Panel/Interface.pm
@@ -560,7 +560,7 @@ sub mkDesc {
}
my @single_valued_keys = qw/isActive/;
-my @multi_valued_keys = qw/description catchAlls
+my @multi_valued_keys = qw/description catchAll
canAddAlias canAddList/;
sub fill_HTML_template_from_entry {
diff --git a/lib/Fripost/Schema/Domain.pm b/lib/Fripost/Schema/Domain.pm
index 44ad84e..950484b 100644
--- a/lib/Fripost/Schema/Domain.pm
+++ b/lib/Fripost/Schema/Domain.pm
@@ -73,7 +73,7 @@ addresses of the domain owners (other than postmasters).
An optional array reference containing the (internationalized) e-mails
addresses of the domain postmasters.
-=item B<catchAlls>
+=item B<catchAll>
An optional array reference containing the (internationalized)
catch-alls for that domain. Localparts may be left empty for domain
@@ -213,9 +213,10 @@ sub search {
);
ldap_error($domains, %options) // return;
+ return unless defined wantarray;
return $domains->count if $options{'-count'};
- &_entries_to_domains( $self->whoami, $options{'-keys'} // [],
+ &_entries_to_domains( $self->whoami, $options{'-keys'},
wantarray ? ( $options{'-sort'} ? $domains->sorted('fvd')
: $domains->entries )
: $domains->pop_entry
@@ -229,7 +230,7 @@ sub _entries_to_domains {
my @dn = @{ldap_explode_dn $user};
shift @dn;
my $parent = lc (canonical_dn @dn);
- my $keys = shift;
+ my $keys = shift // [];
my @domains;
foreach my $entry (@_) {
@@ -270,8 +271,8 @@ sub _entries_to_domains {
if not @$keys or grep { $_ eq 'postmaster' } @$keys;
}
elsif ($attr eq 'fripostOptionalMaildrop') {
- $domain{catchAlls} = [ map { &_email_to_unicode($_) } @$val ]
- if not @$keys or grep { $_ eq 'catchAlls' } @$keys;
+ $domain{catchAll} = [ map { &_email_to_unicode($_) } @$val ]
+ if not @$keys or grep { $_ eq 'catchAll' } @$keys;
}
elsif ($attr eq 'description') {
$domain{description} = [ map { Encode::_utf8_on($_); $_ } @$val ]
@@ -320,7 +321,7 @@ sub _keys_to_attrs {
, canAddList => 'fripostCanAddList'
, owner => 'fripostOwner'
, postmaster => 'fripostPostmaster'
- , catchAlls => 'fripostOptionalMaildrop'
+ , catchAll => 'fripostOptionalMaildrop'
, description => 'description'
, permissions => [ qw/fripostCanAddAlias fripostCanAddList
fripostOwner fripostPostmaster/ ]
@@ -574,8 +575,8 @@ sub _domain_to_entry {
elsif ($key eq 'description') {
$entry{description} = $domain{description};
}
- elsif ($key eq 'catchAlls') {
- $entry{fripostOptionalMaildrop} = $domain{catchAlls};
+ elsif ($key eq 'catchAll') {
+ $entry{fripostOptionalMaildrop} = $domain{catchAll};
}
elsif ($key eq 'canAddAlias') {
$entry{fripostCanAddAlias} =
@@ -699,9 +700,9 @@ sub _is_valid {
eval {
Fripost::Schema::Util::must_attrs( $d, qw/name isActive/ );
$d->{name} = domain_valid( $d->{name} );
- $d->{catchAlls} = [ map { email_valid($_, -prefix => 'fake') }
- @{$d->{catchAlls}} ]
- if $d->{catchAlls};
+ $d->{catchAll} = [ map { email_valid($_, -prefix => 'fake') }
+ @{$d->{catchAll}} ]
+ if $d->{catchAll};
$d->{canAddAlias} = [ map { email_valid($_, -prefix => 'fake') }
@{$d->{canAddAlias}} ]
if $d->{canAddAlias};
diff --git a/lib/Fripost/Schema/Util.pm b/lib/Fripost/Schema/Util.pm
index 6fb84dc..2d1a60f 100644
--- a/lib/Fripost/Schema/Util.pm
+++ b/lib/Fripost/Schema/Util.pm
@@ -157,7 +157,7 @@ sub split_addr {
my $addr = shift;
my %options = @_;
- $addr =~ /^(.*)\@([^@]+)$/s;
+ $addr =~ /^(.*)\@([^\@]+)$/s;
my ($l,$d) = ($1, $2);
if (defined $options{'-encode'}) {
@@ -246,7 +246,7 @@ sub ldap_and_filter {
return $filters[0];
}
else {
- @filters = map {'('.$_.')'} @filters;
+ @filters = map { /^\(.*\)$/ ? $_ : '('.$_.')' } @filters;
return '(&'.(join '', @filters).')';
}
}
diff --git a/templates/add-domain-1.html b/templates/add-domain-1.html
index 9b7de76..a7afc6f 100644
--- a/templates/add-domain-1.html
+++ b/templates/add-domain-1.html
@@ -70,7 +70,7 @@
<hr/>
<h4 class="label" id="catch-all">Catch-All aliases</h4>
- <textarea name="catchAlls" cols="50" rows="5" ><TMPL_VAR NAME=catchAlls></textarea>
+ <textarea name="catchAll" cols="50" rows="5" ><TMPL_VAR NAME=catchAll></textarea>
<div class="help">
An optional list of destinations (one e-mail address per line) that
will receive mail sent to <i>non existing</i> recipients.
diff --git a/templates/add-domain-2.html b/templates/add-domain-2.html
index 72bc0d8..9565d8a 100644
--- a/templates/add-domain-2.html
+++ b/templates/add-domain-2.html
@@ -25,7 +25,7 @@
<input type="hidden" name="name" value="<TMPL_VAR NAME=name>" />
<input type="hidden" name="isActive" value="<TMPL_VAR NAME=isActive>" />
<input type="hidden" name="description" value="<TMPL_VAR NAME=description>" />
- <input type="hidden" name="catchAlls" value="<TMPL_VAR NAME=catchAlls>" />
+ <input type="hidden" name="catchAll" value="<TMPL_VAR NAME=catchAll>" />
<TMPL_IF NAME=owners>
<div class="message">
diff --git a/templates/edit-domain.html b/templates/edit-domain.html
index 9acd52f..d95c8fb 100644
--- a/templates/edit-domain.html
+++ b/templates/edit-domain.html
@@ -60,7 +60,7 @@
<hr/>
<h4 class="label" id="catch-all">Catch-All aliases</h4>
- <textarea name="catchAlls" cols="50" rows="5" ><TMPL_VAR NAME=catchAlls></textarea>
+ <textarea name="catchAll" cols="50" rows="5" ><TMPL_VAR NAME=catchAll></textarea>
<div class="help">
An optional list of destinations (one e-mail address per line) that
will receive mail sent to <i>non existing</i> recipients.
diff --git a/templates/list-domains.html b/templates/list-domains.html
index c5c662b..e0fe52e 100644
--- a/templates/list-domains.html
+++ b/templates/list-domains.html
@@ -36,9 +36,9 @@
<td><span class="domain"><TMPL_UNLESS NAME=isPending><a
href="<TMPL_VAR NAME=URI>/"></TMPL_UNLESS><TMPL_VAR NAME=name><TMPL_UNLESS NAME=isPending></a></TMPL_UNLESS></span></td>
<td><TMPL_IF NAME=isPending
- ><form class="unlock" method="post" action="<TMPL_VAR NAME=domain>/?"
+ ><form class="unlock" method="post" action="<TMPL_VAR NAME=name>/?"
><input type="text" name="unlock" size="32"
- ><input type="hidden" name="domain" value="<TMPL_VAR NAME=domain>"
+ ><input type="hidden" name="domain" value="<TMPL_VAR NAME=name>"
/><input type="submit" name="submit" value="Unlock domain"
/></form
><TMPL_ELSE><TMPL_IF NAME=description><TMPL_VAR NAME=description><TMPL_ELSE><span class="none">(none)</span></TMPL_IF