Bugzilla – Attachment 83490 Details for
Bug 21547
Use set_password in opac-passwd and remove sub goodkey
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21547: (follow-up) Rely on Koha::Patron->set_password checks
Bug-21547-follow-up-Rely-on-KohaPatron-setpassword.patch (text/plain), 2.55 KB, created by
Tomás Cohen Arazi
on 2018-12-26 15:31:52 UTC
(
hide
)
Description:
Bug 21547: (follow-up) Rely on Koha::Patron->set_password checks
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2018-12-26 15:31:52 UTC
Size:
2.55 KB
patch
obsolete
>From 9c3a78a5d38c3610376e44af5bccd8bd2d034f1c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 26 Dec 2018 12:25:54 -0300 >Subject: [PATCH] Bug 21547: (follow-up) Rely on Koha::Patron->set_password > checks > >This patch makes the controller just call $patron->set_password and use >the exceptions it might raise instead of manually checking the passwor >strength. > >No behaviour change should be expected. It also removes some leftovers. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > opac/opac-passwd.pl | 21 +++++++++++---------- > 1 file changed, 11 insertions(+), 10 deletions(-) > >diff --git a/opac/opac-passwd.pl b/opac/opac-passwd.pl >index f183506f27..60d79f61c3 100755 >--- a/opac/opac-passwd.pl >+++ b/opac/opac-passwd.pl >@@ -24,15 +24,14 @@ use CGI qw ( -utf8 ); > > use C4::Auth; # checkauth, getborrowernumber. > use C4::Context; >-use Digest::MD5 qw(md5_base64); > use C4::Circulation; > use C4::Members; > use C4::Output; >-use Koha::AuthUtils qw(hash_password); > use Koha::Patrons; > >+use Try::Tiny; >+ > my $query = new CGI; >-my $dbh = C4::Context->dbh; > > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { >@@ -60,17 +59,19 @@ if ( C4::Context->preference("OpacPasswordChange") ) { > $template->param( 'Error_messages' => '1' ); > $template->param( 'passwords_mismatch' => '1' ); > } else { >- my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $new_password ); >- unless ( $is_valid ) { >- $error = 'password_too_short' if $error eq 'too_short'; >- $error = 'password_too_weak' if $error eq 'too_weak'; >- $error = 'password_has_whitespaces' if $error eq 'has_whitespaces'; >- } else { >- # Password is valid and match >+ try { > $patron->set_password( $new_password ); > $template->param( 'password_updated' => '1' ); > $template->param( 'borrowernumber' => $borrowernumber ); > } >+ catch { >+ $error = 'password_too_short' >+ if $_->isa('Koha::Exceptions::Password::TooShort'); >+ $error = 'password_too_weak' >+ if $_->isa('Koha::Exceptions::Password::TooWeak'); >+ $error = 'password_has_whitespaces' >+ if $_->isa('Koha::Exceptions::Password::WhitespaceCharacters'); >+ }; > } > } > else { >-- >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 21547
:
80391
|
80393
|
80400
|
82881
|
82882
|
82883
| 83490