Bugzilla – Attachment 101984 Details for
Bug 23473
Add option to import/overwrite passwords when using the patron import tool
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23473: (follow-up) Catch and show password exceptions
Bug-23473-follow-up-Catch-and-show-password-except.patch (text/plain), 4.16 KB, created by
Marcel de Rooy
on 2020-03-27 10:43:44 UTC
(
hide
)
Description:
Bug 23473: (follow-up) Catch and show password exceptions
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-03-27 10:43:44 UTC
Size:
4.16 KB
patch
obsolete
>From 7da65c9c53e4ff21ebf303a1109ead0c69ad1a58 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 5 Nov 2019 12:58:45 +0000 >Subject: [PATCH] Bug 23473: (follow-up) Catch and show password exceptions >Content-Type: text/plain; charset=utf-8 > >--- > Koha/Patrons/Import.pm | 22 ++++++++++++++++++- > .../prog/en/modules/tools/import_borrowers.tt | 25 ++++++++++++++++++++++ > 2 files changed, 46 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index ed1e68deaf..06a411ede2 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -22,6 +22,7 @@ use namespace::clean; > use Carp; > use Text::CSV; > use Encode qw( decode_utf8 ); >+use Try::Tiny; > > use C4::Members; > >@@ -303,7 +304,26 @@ sub import_patrons { > } > } > if ($overwrite_passwords){ >- $patron->set_password({ password => $borrower{password} }); >+ try { >+ $patron->set_password({ password => $borrower{password} }); >+ } >+ catch { >+ if ( $_->isa('Koha::Exceptions::Password::TooShort') ) { >+ push @errors, { passwd_too_short => 1, borrowernumber => $borrowernumber, length => $_->{length}, min_length => $_->{min_length} }; >+ } >+ elsif ( $_->isa('Koha::Exceptions::Password::WhitespaceCharacters') ) { >+ push @errors, { passwd_whitespace => 1, borrowernumber => $borrowernumber } ; >+ } >+ elsif ( $_->isa('Koha::Exceptions::Password::TooWeak') ) { >+ push @errors, { passwd_too_weak => 1, borrowernumber => $borrowernumber } ; >+ } >+ elsif ( $_->isa('Koha::Exceptions::Password::Plugin') ) { >+ push @errors, { passwd_plugin_err => 1, borrowernumber => $borrowernumber } ; >+ } >+ else { >+ push @errors, { passwd_unknown_err => 1, borrowernumber => $borrowernumber } ; >+ } >+ } > } > if ($extended) { > if ($ext_preserve) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >index e7c463124b..70fe71712b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >@@ -115,6 +115,31 @@ > Userid [% e.userid | html %] is already used by another patron. > </li> > [% END %] >+ [% IF e.passwd_too_short %] >+ <li class="line_error"> >+ Password is too short for patron with borrowernumber [% e.borrowernumber | html %]. Minimum length is [% e.min_length %], length is [% e.length %] >+ </li> >+ [% END %] >+ [% IF e.passwd_whitespace %] >+ <li class="line_error"> >+ Password contains whitespace for patron with borrowernumber [% e.borrowernumber | html %]. >+ </li> >+ [% END %] >+ [% IF e.passwd_too_weak %] >+ <li class="line_error"> >+ Password is too weak for patron with borrowernumber [% e.borrowernumber | html %]. >+ </li> >+ [% END %] >+ [% IF e.passwd_plugin_err %] >+ <li class="line_error"> >+ Password plugin error for patron with borrowernumber [% e.borrowernumber | html %]. >+ </li> >+ [% END %] >+ [% IF e.passwd_unknown_err %] >+ <li class="line_error"> >+ Password error for patron with borrowernumber [% e.borrowernumber | html %]. >+ </li> >+ [% END %] > [% END %] > </ul> > </div> >-- >2.11.0
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 23473
:
92352
|
93073
|
93074
|
93594
|
94822
|
95049
|
95050
|
95051
|
95052
|
96998
|
96999
|
97000
|
97001
|
97002
|
97003
|
98382
|
101981
|
101982
|
101983
| 101984 |
101985
|
101986
|
101987
|
101988