From addd5c640c3d1bc99f03c4cc3447aeccb88dfed7 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 9f4d39e029c43c1a662445f01c44c0291efa8beb 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 951a0b233f011fbefb767045562328512e635e68 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);