From 7b81775603b8208c995cd1c4a15cd2a287009404 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 29 Jan 2013 02:37:58 +0100 Subject: Bug fixes. --- lib/Fripost/Panel/Interface.pm | 38 +++++++++++--------------------------- lib/Fripost/Panel/Login.pm | 6 ++---- 2 files changed, 13 insertions(+), 31 deletions(-) (limited to 'lib/Fripost/Panel') diff --git a/lib/Fripost/Panel/Interface.pm b/lib/Fripost/Panel/Interface.pm index eb9d69a..a0c9dd9 100644 --- a/lib/Fripost/Panel/Interface.pm +++ b/lib/Fripost/Panel/Interface.pm @@ -19,7 +19,7 @@ use Fripost::Password; use HTML::Entities 'encode_entities'; use URI::Escape::XS 'encodeURIComponent'; use Net::IDN::Encode qw/email_to_unicode email_to_ascii domain_to_ascii/; -use Encode; +use Encode (); # This method is called right before the 'setup' method below. It @@ -139,12 +139,11 @@ sub EditDomain : Runmode { my $self = shift; my %CFG = $self->cfg; - # Get the domain name from the URL. - my $domainname = ($self->split_path)[1]; - my $q = $self->query; return $self->redirect('./') if defined $q->param('cancel'); # Cancellation + # Get the domain name from the URL. + my $domainname = ($self->split_path)[1]; my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); my $error; # Tells whether the change submission has failed. @@ -185,10 +184,13 @@ sub ListLocals : Runmode { my $self = shift; my %CFG = $self->cfg; + my $q = $self->query; + return $self->redirect('./') if defined $q->param('cancel'); # Cancellation + + # Get the domain name from the URL. my $domainname = ($self->split_path)[1]; my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG ); - my $q = $self->query; if (defined $q->param('unlock')) { # Unlock the domain, and come back to the home page. # Errors are thrown away. @@ -512,37 +514,18 @@ sub mkURL { join '/', ($host, @path); } -sub mkLink { - my $k = shift; - my $d = shift; - ( $k => encode_entities($d), - $k.'URL' => &mkURL('.', $d) ) -} - sub userInfo { my $self = shift; my ($l,$d) = split_addr( $self->authen->username, -encode => 'unicode' ); my $root = $ENV{SCRIPT_NAME} // $self->cfg->{'cgi-bin'} // ''; $root =~ s@/$@@s; - ( user_localpart => encode_entities($l) + ( user_localpart => encode_entities($l) , user_domainpart => encode_entities($d) - , userURL => &mkURL ($root, $d, $l) + , user_URL => &mkURL ($root, $d, $l) ) } -sub mkFormContentE { # TODO delete - &mkFormContent (map { encode_entities ($_) } @_); -} - -sub mkFormContent { # TODO delete - join ("\x{0D}\x{0A}", @_); -} - -sub mkDesc { # TODO delete - my $desc = shift // return ''; - join '
', map {encode_entities($_)} @$desc; -} my @single_valued_keys = qw/isActive quota/; my @multi_valued_keys = qw/description catchAll @@ -561,7 +544,8 @@ sub fill_HTML_template_from_entry { if ($key eq 'name') { $vars{$key} = encode_entities($entry->{$key}); } - elsif (grep {$key eq $_} ('URL', 'listURL', @single_valued_keys)) { + elsif (grep {$key eq $_} (qw/URL list_URL transport/, + @single_valued_keys)) { $vars{$key} = $entry->{$key}; } elsif (grep {$key eq $_} @multi_valued_keys) { diff --git a/lib/Fripost/Panel/Login.pm b/lib/Fripost/Panel/Login.pm index 1eabafb..22a870a 100644 --- a/lib/Fripost/Panel/Login.pm +++ b/lib/Fripost/Panel/Login.pm @@ -23,7 +23,7 @@ use Fripost::Schema::Util 'split_addr'; use HTML::Entities 'encode_entities'; use URI::Escape::XS 'decodeURIComponent'; -use Encode; +use Encode (); # This method is called right before the 'setup' method below. It # initializes the session and authentication configurations. @@ -56,9 +56,7 @@ sub cgiapp_init { $self->authen->config( DRIVER => [ 'Generic', sub { my ($u,$p) = @_; - my $d = (split_addr($u))[1]; - - unless (defined $d) { + unless ($u =~ /\@/) { $CFG{default_realm} // return 0; $u .= '@'.$CFG{default_realm}; } -- cgit v1.2.3