aboutsummaryrefslogtreecommitdiffstats
path: root/lib/FPanel/Login.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/FPanel/Login.pm')
-rw-r--r--lib/FPanel/Login.pm40
1 files changed, 26 insertions, 14 deletions
diff --git a/lib/FPanel/Login.pm b/lib/FPanel/Login.pm
index 173a34f..76dc5bb 100644
--- a/lib/FPanel/Login.pm
+++ b/lib/FPanel/Login.pm
@@ -185,24 +185,36 @@ sub logout : Runmode {
return $self->redirect($self->query->self_url);
}
-# This is the error Run Mode. Users are not suppose to see that unless
-# the CGI crashes :P
+# This is the error Run Mode.
sub error_rm : ErrorRunmode {
my $self = shift;
my $error = shift;
-
- my $template = $self->load_tmpl( 'error.html', cache => 1, utf8 => 1 );
- $template->param( EMAIL => $self->cfg('report_email') );
- $template->param( MESSAGE => $error );
- $template->param( URL => $self->query->url . '/');
-
- return $template->output;
-}
-sub error_404 : Runmode {
- my $self = shift;
- $self->header_props ( -status => '404 Not found' );
- return '';
+ if ($error =~ /^4\d+$/) {
+ # HTTP client error.
+ chomp $error;
+ $self->header_props ( -status => $error );
+ my $template = $self->load_tmpl( 'error_http.html', cache => 1, utf8 => 1 );
+ my $mesg;
+ if ($error eq '403' ) {
+ $mesg = 'Forbidden'
+ }
+ elsif ($error eq '404' ) {
+ $mesg = 'Not found'
+ }
+ $template->param( CODE => $error );
+ $template->param( MESSAGE => $mesg );
+ return $template->output;
+ }
+
+ else {
+ # Users are not supposed to see that unless the CGI crashes :P
+ my $template = $self->load_tmpl( 'error.html', cache => 1, utf8 => 1 );
+ $template->param( EMAIL => $self->cfg('report_email') );
+ $template->param( MESSAGE => $error );
+ $template->param( URL => $self->query->url . '/');
+ return $template->output;
+ }
}
1;