Add basic error handling.

Will be rebuilt using formhandler.
agranig/1_0_subfix
Andreas Granig 12 years ago
parent 11fecbd7ae
commit 76e9d458d4

@ -0,0 +1,11 @@
The design is based on "Dashboard Admin" copyright 2012 http://jumpstartui.com/.
An Extended License has been purchased from here:
https://wrapbootstrap.com/theme/dashboard-admin-WB0164888?l=e
The license details are as follows:
Item: Dashboard Admin (Extended License)
Item#: WB0164888
License: Extended License
License ID: 9890cae9-cadf-4b2a-9c86-840570356df5

@ -65,7 +65,7 @@ __PACKAGE__->config(
session => {
flash_to_stash => 1,
expires => 3600,
},
},
'Plugin::Authentication' => {
default => {

@ -1,7 +1,7 @@
package NGCP::Panel::Controller::Login;
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
=head1 NAME
@ -21,18 +21,18 @@ Catalyst Controller.
=cut
sub index :Path {
sub index :Path Form {
my ( $self, $c, $realm ) = @_;
$c->log->debug("*** Login::index");
my $user = $c->req->params->{username};
my $pass = $c->req->params->{password};
$realm = 'subscriber'
unless($realm and ($realm eq 'admin' or $realm eq 'reseller'));
if($user and $pass) {
my $user = $c->request->param('username');
my $pass = $c->request->param('password');
$c->log->debug("*** Login::index user=$user, pass=$pass, realm=$realm");
if($user && $pass) {
$c->log->debug("*** Login::index user=$user, pass=$pass, realm=$realm");
if($c->authenticate({ username => $user, password => $pass }, $realm)) {
# auth ok
@ -42,9 +42,12 @@ sub index :Path {
$c->response->redirect($target);
} else {
$c->log->debug("*** Login::index auth failed");
$c->stash->{error}->{message} = 'login failed';
}
} else {
$c->log->debug("*** Login::index incomplete creds");
if($user || $pass) {
$c->stash->{error}->{message} = 'invalid form';
}
}
$c->stash(realm => $realm);

@ -1,4 +1,9 @@
<body class="login">
[% IF error.message -%]
<div class="alert alert-error">
<span>[% error.message -%]</span>
</div>
[% END -%]
<div class="account-container login stacked">
<div class="content clearfix">
<form method="post" action="[% c.uri_for("/login/$realm") %]" novalidate="novalidate">

Loading…
Cancel
Save