From 832dab70cbe14178d54be0ed4204c49cad34bca9 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 21 Nov 2017 10:40:22 +0000 Subject: [PATCH 1/3] dded minor logging to API login endpoint --- lib/Pear/LocalLoop/Controller/Api/Auth.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Pear/LocalLoop/Controller/Api/Auth.pm b/lib/Pear/LocalLoop/Controller/Api/Auth.pm index 82cfb60..cf6b466 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Auth.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Auth.pm @@ -74,6 +74,8 @@ sub post_login { my $email = $validation->param('email'); my $password = $validation->param('password'); + $c->app->log->debug( __PACKAGE__ . " login attempt for [" . $email . "]" ); + my $user_result = $c->schema->resultset('User')->find({ email => $email }); if ( defined $user_result ) { @@ -86,6 +88,8 @@ sub post_login { display_name => $user_result->name, user_type => $user_result->type, }); + } else { + $c->app->log->info( __PACKAGE__ . " failed login for [" . $email . "]" ); } } return $c->render( From b92ea1f7c61b88738fbff87bc52d87e05214c4ab Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 21 Nov 2017 10:42:23 +0000 Subject: [PATCH 2/3] Added logging on admin login endpoint --- lib/Pear/LocalLoop/Controller/Admin.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Pear/LocalLoop/Controller/Admin.pm b/lib/Pear/LocalLoop/Controller/Admin.pm index 1e5a411..eee9253 100644 --- a/lib/Pear/LocalLoop/Controller/Admin.pm +++ b/lib/Pear/LocalLoop/Controller/Admin.pm @@ -38,9 +38,12 @@ sub home { sub auth_login { my $c = shift; + $c->app->log->debug( __PACKAGE__ . " admin login attempt for [" . $c->param('email') . "]" ); + if ( $c->authenticate($c->param('email'), $c->param('password')) ) { $c->redirect_to('/admin/home'); } else { + $c->app->log->info( __PACKAGE__ . " failed admin login for [" . $c->param('email') . "]" ); $c->redirect_to('/admin'); } } From 8855d64a6ee9579ecfde797ded7133d43d262e8a Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 21 Nov 2017 10:48:32 +0000 Subject: [PATCH 3/3] Fix minor issue in ddl for SQLite --- share/ddl/SQLite/deploy/13/001-auto.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/ddl/SQLite/deploy/13/001-auto.sql b/share/ddl/SQLite/deploy/13/001-auto.sql index 8d1b47b..e54791e 100644 --- a/share/ddl/SQLite/deploy/13/001-auto.sql +++ b/share/ddl/SQLite/deploy/13/001-auto.sql @@ -128,7 +128,7 @@ CREATE TABLE feedback ( package_name varchar(255) NOT NULL, version_code 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 ); CREATE INDEX feedback_idx_user_id ON feedback (user_id);