From 7076e66b79a98a3978b3a967fdea792b5b9d1cd5 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 1 Feb 2013 02:17:24 +0100 Subject: Make the whole configuration available through the library. --- lib/Fripost/Panel/Interface.pm | 17 +++++++---------- lib/Fripost/Panel/Login.pm | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'lib/Fripost/Panel') diff --git a/lib/Fripost/Panel/Interface.pm b/lib/Fripost/Panel/Interface.pm index 675c9ba..f357b53 100644 --- a/lib/Fripost/Panel/Interface.pm +++ b/lib/Fripost/Panel/Interface.pm @@ -40,7 +40,7 @@ sub ListDomains : StartRunmode { my $self = shift; my %CFG = $self->cfg; - my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); + my $fp = Fripost::Schema::->SASLauth( $self->authen->username, \%CFG ); my @domains = $fp->domain->search( undef, -sort => 1, -keys => [qw/name isActive isPending description/]); my $canIAdd = $fp->domain->domain->canIAdd; @@ -78,7 +78,7 @@ sub AddDomain : Runmode { my $error; # Tells whether the change submission has failed. if (defined $q->param('submit')) { # Changes have been submitted: process them - my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); + my $fp = Fripost::Schema::->SASLauth( $self->authen->username, \%CFG ); if (defined $q->param('owner') and defined $session_param) { # Ensure that the user didn't spoof the domain ownership. @@ -93,9 +93,6 @@ sub AddDomain : Runmode { , '-send-confirmation-token' => $q->param('owner') // undef , '-dry-run' => not (defined $q->param('owner')) , -error => \$error - , webapp_url => $self->cfg('webapp_url') - , tmpl_path => $self->cfg('tmpl_path') - , email_from => $self->cfg('email_from') ); $fp->done; } @@ -148,7 +145,7 @@ sub EditDomain : Runmode { # Get the domain name from the URL. my $domainname = ($self->split_path)[1]; - my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); + my $fp = Fripost::Schema::->SASLauth( $self->authen->username, \%CFG ); my $error; # Tells whether the change submission has failed. if (defined $q->param('submit')) { @@ -193,7 +190,7 @@ sub ListLocals : Runmode { # Get the domain name from the URL. my $domainname = ($self->split_path)[1]; - my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); + my $fp = Fripost::Schema::->SASLauth( $self->authen->username, \%CFG ); if (defined $q->param('unlock')) { # Unlock the domain, and come back to the home page. @@ -294,7 +291,7 @@ sub AddLocal : Runmode { my $domainname = ($self->split_path)[1]; my $t = $q->param('t') or return $self->redirect('./'); return $self->redirect('./') unless grep { $t eq $_ } qw/user alias list/; - my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); + my $fp = Fripost::Schema::->SASLauth( $self->authen->username, \%CFG ); my $error; # Tells whether the change submission has failed. if (defined $q->param('submit')) { @@ -330,7 +327,7 @@ sub AddLocal : Runmode { }; unless ($error) { - my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); + my $fp = Fripost::Schema::->SASLauth( $self->authen->username, \%CFG ); $fp->domain->search ($domainname, -filter => 'unlocked', -count => 1) or die "404\n"; $fp->local->add( $local, %rest, -error => \$error ); @@ -372,7 +369,7 @@ sub EditLocal : Runmode { # Get the domain name from the URL. my ($localname,$domainname) = ($self->split_path)[2,1]; my $name = $localname.'@'.$domainname; - my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); + my $fp = Fripost::Schema::->SASLauth( $self->authen->username, \%CFG ); # Search for *the* matching user, alias or list. $fp->domain->search ($domainname, -filter => 'unlocked', -count => 1) diff --git a/lib/Fripost/Panel/Login.pm b/lib/Fripost/Panel/Login.pm index 3b2846a..1fca602 100644 --- a/lib/Fripost/Panel/Login.pm +++ b/lib/Fripost/Panel/Login.pm @@ -59,7 +59,7 @@ sub cgiapp_init { $CFG{default_realm} // return 0; $u .= '@'.$CFG{default_realm}; } - my $fp = Fripost::Schema::->auth($u, $p, %CFG, -error => undef) + my $fp = Fripost::Schema::->auth($u, $p, \%CFG, -error => undef) // return 0; $fp->done; return $u; -- cgit v1.2.3