Bugzilla – Attachment 102499 Details for
Bug 21190
Add logging of successful/unsuccessful login attempts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21190: Add authentication logging to checkpw
Bug-21190-Add-authentication-logging-to-checkpw.patch (text/plain), 1.56 KB, created by
Jonathan Druart
on 2020-04-07 10:27:49 UTC
(
hide
)
Description:
Bug 21190: Add authentication logging to checkpw
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-07 10:27:49 UTC
Size:
1.56 KB
patch
obsolete
>From c102f234e46514f76d9bce4da47bec0b56bf8bb9 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 25 Oct 2019 09:55:32 +0000 >Subject: [PATCH] Bug 21190: Add authentication logging to checkpw > >Add optional logging for successful and failing login attempts in >checkpw. > >Test plan: >Enable the preferences >Perform a good login and a bad attempt >Check action_logs > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk> > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Auth.pm | 9 +++++++++ > 1 file changed, 9 insertions(+) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 067c576950..e00d6216da 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -45,6 +45,7 @@ use List::MoreUtils qw/ any /; > use Encode qw( encode is_utf8); > use C4::Auth_with_shibboleth; > use Net::CIDR; >+use C4::Log qw/logaction/; > > # use utf8; > use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $caslogout); >@@ -1862,6 +1863,14 @@ sub checkpw { > $patron->update({ login_attempts => $patron->login_attempts + 1 }); > } > } >+ >+ # Optionally log success or failure >+ if( $patron && $passwd_ok && C4::Context->preference('AuthSuccessLog') ) { >+ logaction( 'AUTH', 'SUCCESS', $patron->id, "Valid password for $userid", $type ); >+ } elsif( !$passwd_ok && C4::Context->preference('AuthFailureLog') ) { >+ logaction( 'AUTH', 'FAILURE', 0, "Wrong password for $userid", $type ); >+ } >+ > return @return; > } > >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21190
:
94713
|
94714
|
94715
|
94717
|
94732
|
94733
|
94734
|
94735
|
94736
|
94805
|
98067
|
98068
|
98069
|
98070
|
98071
|
98072
|
98073
|
98074
|
98110
|
98111
|
98112
|
98113
|
98114
|
98115
|
98116
|
98117
|
98125
|
98133
|
98134
|
98135
|
98136
|
98137
|
98138
|
98139
|
98140
|
98141
|
101971
|
101972
|
101973
|
101974
|
101975
|
101976
|
101977
|
101978
|
101979
|
102493
|
102494
|
102496
|
102497
|
102498
| 102499 |
102500
|
102501
|
102502
|
123540