From 06a4de26e05b74e3ed5493cef205af91462678a1 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 23 Sep 2012 20:57:43 +0200 Subject: Making the list creation method. --- lib/Fripost/Panel/Interface.pm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'lib/Fripost/Panel/Interface.pm') diff --git a/lib/Fripost/Panel/Interface.pm b/lib/Fripost/Panel/Interface.pm index 46d4058..e253ca0 100644 --- a/lib/Fripost/Panel/Interface.pm +++ b/lib/Fripost/Panel/Interface.pm @@ -37,7 +37,7 @@ sub ListDomains : StartRunmode { my ($ul,$ud) = split /\@/, email_to_unicode($self->authen->username), 2; - my $fp = Fripost::Schema->SASLauth( $self->authen->username, %CFG ); + my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); my @domains = $fp->domain->search( -concat => "\n", -die => 403); $fp->done; @@ -139,6 +139,7 @@ sub ListLocals : Runmode { , description => join ("\n", @{$_->{description}}) , isactive => $_->{isactive} , transport => $_->{transport} + , listurl => $CFG{'listurl_'.$_->{transport}}.$_->{list}.'@'.$d }; } @lists @@ -360,6 +361,7 @@ sub AddLocal : Runmode { if (defined $q->param('submit')) { # Changes have been submitted: process them my %entry; + my %rest; if ($t eq 'mailbox') { $entry{user} = $q->param('user').'@'.$du; $entry{forwards} = $q->param('forwards'); @@ -383,6 +385,22 @@ sub AddLocal : Runmode { elsif ($t eq 'list') { $entry{list} = $q->param('list').'@'.$du; $entry{transport} = $q->param('transport'); + if ($q->param('password') ne $q->param('password2')) { + $error = "Passwords do not match"; + } + elsif (length $q->param('password') < $CFG{password_min_length}) { + $error = "Password should be at least " + .$CFG{password_min_length} + ." characters long."; + } + else { + $rest{gpg} = { use_agent => 0 + , keydir => $CFG{gpghome} + , key => $CFG{gpg_private_key_id} + , passphrase => $CFG{gpg_private_key_passphrase} + }; + $entry{password} = $q->param('password'); + } } else { # Unknown type @@ -393,7 +411,7 @@ sub AddLocal : Runmode { unless ($error) { my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); - $error = $fp->$t->add( \%entry, -concat => "(\n|\x{0D}\x{0A})"); + $error = $fp->$t->add( \%entry, -concat => "(\n|\x{0D}\x{0A})", %rest); $fp->done; return $self->redirect($q->url.'/'.$d.'/') unless $error; } -- cgit v1.2.3