Bugzilla – Attachment 114719 Details for
Bug 27309
Add plugin hooks for capturing raw passwords (NNPDB)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27309 - Add plugin hooks for capturing passwords
Bug-27309---Add-plugin-hooks-for-capturing-passwor.patch (text/plain), 3.21 KB, created by
Magnus Enger
on 2020-12-29 11:03:33 UTC
(
hide
)
Description:
Bug 27309 - Add plugin hooks for capturing passwords
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2020-12-29 11:03:33 UTC
Size:
3.21 KB
patch
obsolete
>From cf1d22f1e585f3874987bb7b8157ee6b2ba6ac72 Mon Sep 17 00:00:00 2001 >From: Magnus Enger <magnus@libriotech.no> >Date: Tue, 29 Dec 2020 11:54:10 +0100 >Subject: [PATCH] Bug 27309 - Add plugin hooks for capturing passwords > >This might sound like a stupid idea, but it is necessary in order >to implement support for the Norwegian National Patron Database >as a plugin in Koha. The plugin hook captures the borrowernumber >and raw password of a user and sends it to a plugin. > >I created a tiny plugin to be able to test the functionality: >https://github.com/Libriotech/koha-plugin-capturepw >This plugin will capture borrowernumbers and raw passwords >when a user is added or updated. The borrowernumber and a >md5-hashed version of the password is stored in a tiny database >table (koha_plugin_no_libriotech_capturepw_capturepw) created by >the plugin. > >To test: >- Enable plugins >- Install the CapturePW plugin >- Add and edit users in all possible ways, including >-- Setting a password for a new user >-- Changing a password in the staff client >-- Changing a password in the OPAC >-- Creating a disabled user account > >Check the database table for updates after each operation. If a new >line is added to the database for each operation, and the md5 hash >changes when a password is changed, everything should be ok. >--- > Koha/Patron.pm | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 64e8fac486..425247605a 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -264,6 +264,19 @@ sub store { > > $self = $self->SUPER::store; > >+ # Call any capture_raw_password plugins >+ if ( C4::Context->config("enable_plugins") && $self->plain_text_password ) { >+ my @capture_raw_password_plugins = Koha::Plugins->new()->GetPlugins({ >+ method => 'capture_raw_password', >+ }); >+ foreach my $plugin ( @capture_raw_password_plugins ) { >+ $plugin->capture_raw_password({ >+ password => $self->plain_text_password, >+ borrowernumber => $self->borrowernumber >+ }); >+ } >+ } >+ > $self->add_enrolment_fee_if_needed(0); > > logaction( "MEMBERS", "CREATE", $self->borrowernumber, "" ) >@@ -825,6 +838,7 @@ sub set_password { > } > > if ( C4::Context->config("enable_plugins") ) { >+ > # Call any check_password plugins > my @plugins = Koha::Plugins->new()->GetPlugins({ > method => 'check_password', >@@ -846,6 +860,18 @@ sub set_password { > Koha::Exceptions::Password::Plugin->throw(); > } > } >+ >+ # Call any capture_raw_password plugins >+ my @capture_raw_password_plugins = Koha::Plugins->new()->GetPlugins({ >+ method => 'capture_raw_password', >+ }); >+ foreach my $plugin ( @capture_raw_password_plugins ) { >+ $plugin->capture_raw_password({ >+ password => $password, >+ borrowernumber => $self->borrowernumber >+ }); >+ } >+ > } > > my $digest = Koha::AuthUtils::hash_password($password); >-- >2.17.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 27309
: 114719