aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Panel/Login.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Fripost/Panel/Login.pm')
-rw-r--r--lib/Fripost/Panel/Login.pm23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/Fripost/Panel/Login.pm b/lib/Fripost/Panel/Login.pm
index 00fff72..736207d 100644
--- a/lib/Fripost/Panel/Login.pm
+++ b/lib/Fripost/Panel/Login.pm
@@ -7,7 +7,7 @@ use utf8;
=head1 NAME
-Login.pm -
+Login.pm - Authentication subroutines for the Web Interface.
=cut
@@ -63,8 +63,6 @@ sub cgiapp_init {
$CFG{default_realm} // return 0;
$u .= '@'.$CFG{default_realm};
}
- Encode::_utf8_on($u);
- $u = email_to_ascii($u);
my $fp = Fripost::Schema::->auth($u, $p, %CFG, -die => 0);
return 0 unless defined $fp;
$fp->done;
@@ -105,16 +103,16 @@ sub setup {
# /domain/{user,alias,list}/?query_url
my ($null,$domain,$local,$crap) = $self->split_path;
- return 'ListDomains' if (defined $null) and $null ne '';
+ return 'ListDomains' if $null;
- unless (defined $domain and $domain ne '') {
+ unless ($domain) {
if (defined $a) {
return 'AddDomain' if $a eq 'add';
}
return 'ListDomains';
}
- unless (defined $local and $local ne '') {
+ unless ($local) {
if (defined $a) {
return 'EditDomain' if $a eq 'edit';
return 'AddLocal' if $a eq 'add';
@@ -131,8 +129,7 @@ sub setup {
# wanted to visit.
sub okay : Runmode {
my $self = shift;
- my $redirect = $self->query->param('redirect') //
- $self->query->url;
+ my $redirect = $self->query->param('redirect') // $self->query->url;
return $self->redirect($redirect);
}
@@ -219,18 +216,20 @@ sub error_rm : ErrorRunmode {
}
}
+# Split the URI; give the list of its components.
+# The facing CGI script and trailing query are not considered.
sub split_path {
my $self = shift;
my %options = @_;
my $script = $ENV{SCRIPT_NAME} // $self->cfg->{'cgi-bin'} // '';
- $script =~ s@/$@@s;
+ $script =~ s@/$@@s; # Strip the trailing '/' off the script name
my $uri = $self->query->request_uri;
- $uri =~ s/^$script//s;
- $uri =~ s/\?.*//s;
+ $uri =~ s/^$script//s; # Strip the facing CGI script name
+ $uri =~ s/\?.*//s; # Strip the query
- map { my $x = decodeURIComponent($_); Encode::_utf8_on($x); $x }
+ map { decodeURIComponent($_); Encode::_utf8_on($_); $_ }
(split /\//, $uri);
}