Merge pull request #73 from Pear-Trading/TBSliver/Log-Improvement

Minor logging improvements
This commit is contained in:
Tom Bloor 2017-11-21 11:04:17 +00:00 committed by GitHub
commit c41bbdc35f
3 changed files with 8 additions and 1 deletions

View file

@ -38,9 +38,12 @@ sub home {
sub auth_login { sub auth_login {
my $c = shift; my $c = shift;
$c->app->log->debug( __PACKAGE__ . " admin login attempt for [" . $c->param('email') . "]" );
if ( $c->authenticate($c->param('email'), $c->param('password')) ) { if ( $c->authenticate($c->param('email'), $c->param('password')) ) {
$c->redirect_to('/admin/home'); $c->redirect_to('/admin/home');
} else { } else {
$c->app->log->info( __PACKAGE__ . " failed admin login for [" . $c->param('email') . "]" );
$c->redirect_to('/admin'); $c->redirect_to('/admin');
} }
} }

View file

@ -74,6 +74,8 @@ sub post_login {
my $email = $validation->param('email'); my $email = $validation->param('email');
my $password = $validation->param('password'); my $password = $validation->param('password');
$c->app->log->debug( __PACKAGE__ . " login attempt for [" . $email . "]" );
my $user_result = $c->schema->resultset('User')->find({ email => $email }); my $user_result = $c->schema->resultset('User')->find({ email => $email });
if ( defined $user_result ) { if ( defined $user_result ) {
@ -86,6 +88,8 @@ sub post_login {
display_name => $user_result->name, display_name => $user_result->name,
user_type => $user_result->type, user_type => $user_result->type,
}); });
} else {
$c->app->log->info( __PACKAGE__ . " failed login for [" . $email . "]" );
} }
} }
return $c->render( return $c->render(

View file

@ -128,7 +128,7 @@ CREATE TABLE feedback (
package_name varchar(255) NOT NULL, package_name varchar(255) NOT NULL,
version_code varchar(255) NOT NULL, version_code varchar(255) NOT NULL,
version_number varchar(255) NOT NULL, version_number varchar(255) NOT NULL,
actioned boolean NOT NULL DEFAULT false, actioned boolean NOT NULL DEFAULT 0,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE NO ACTION ON UPDATE NO ACTION FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
CREATE INDEX feedback_idx_user_id ON feedback (user_id); CREATE INDEX feedback_idx_user_id ON feedback (user_id);