From 6397f0df256db7058a58cef697c8f11e10734c84 Mon Sep 17 00:00:00 2001 From: John Doe Date: Fri, 18 Sep 2020 05:55:22 +0000 Subject: [PATCH] Bug 26266: Add jQuery validator to opac-password-recovery.tt To test: 0) Activate password reset in system preferences. 1) Initiate a password recovery. 2) Try to submit with an invalid password. 3) Confirm that validation occurs. 4) Try to submit with mismatching passwords. 5) Confirm that validation occurs. 6) Sign off. --- .../bootstrap/en/modules/opac-password-recovery.tt | 25 +++++++++++++++++++--- opac/opac-password-recovery.pl | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt index 7328f31736..8f9b1083cd 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt @@ -5,6 +5,10 @@ [% INCLUDE 'doc-head-close.inc' %] [% BLOCK cssinclude %][% END %] [% BLOCK jsinclude %] +[% IF (new_password) %] + [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %] + [% PROCESS 'password_check.inc' new_password => 'newPassword', minPasswordLength => minPasswordLength, RequireStrongPassword => RequireStrongPassword %] +[% END %] [% END %] @@ -116,7 +135,7 @@ [% ELSIF (new_password) %] [% UNLESS ( errLinkNotValid ) %] -
+
[% IF ( RequireStrongPassword ) %] @@ -125,8 +144,8 @@
Your password must be at least [% minPasswordLength | html %] characters long.
[% END %]
- - + +
diff --git a/opac/opac-password-recovery.pl b/opac/opac-password-recovery.pl index d688e365a9..3d492dd205 100755 --- a/opac/opac-password-recovery.pl +++ b/opac/opac-password-recovery.pl @@ -27,7 +27,7 @@ my ( $template, $dummy, $cookie ) = get_template_and_user( ); my $email = $query->param('email') // q{}; -my $password = $query->param('password'); +my $password = $query->param('newPassword'); my $repeatPassword = $query->param('repeatPassword'); my $id = $query->param('id'); my $uniqueKey = $query->param('uniqueKey'); -- 2.11.0