From e995f007b48dec45c5c17d058247d75c6b08fc40 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 14 Sep 2018 16:28:12 -0700 Subject: [PATCH] Bug 17006: (follow-up) Whitespace chars follow-up Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/Patrons/Password.pm | 5 ++--- t/db_dependent/api/v1/patrons_password.t | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Koha/REST/V1/Patrons/Password.pm b/Koha/REST/V1/Patrons/Password.pm index 35f51dd26b..9f3f2b063b 100644 --- a/Koha/REST/V1/Patrons/Password.pm +++ b/Koha/REST/V1/Patrons/Password.pm @@ -100,11 +100,10 @@ sub set { length => $password_length, min_length => $min_length ); } elsif ( $error eq 'has_whitespaces' ) { - Koha::Exceptions::Password::TrailingWhitespaces->throw( - "Password contains trailing spaces, which is forbidden."); + Koha::Exceptions::Password::WhitespaceCharacters->throw(); } elsif ( $error eq 'too_weak' ) { - Koha::Exceptions::Password::TooWeak->throw("Password is too weak"); + Koha::Exceptions::Password::TooWeak->throw(); } } diff --git a/t/db_dependent/api/v1/patrons_password.t b/t/db_dependent/api/v1/patrons_password.t index 0443354ed1..49aa8fbba9 100644 --- a/t/db_dependent/api/v1/patrons_password.t +++ b/t/db_dependent/api/v1/patrons_password.t @@ -78,7 +78,7 @@ subtest 'set_password() (authorized user tests)' => sub { $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); - $t->request_ok($tx)->status_is(400)->json_is({ error => 'Password contains trailing spaces, which is forbidden.' }); + $t->request_ok($tx)->status_is(400)->json_is({ error => '[Password contains leading/trailing whitespace character(s)]' }); $new_password = 'abcdefg'; $tx @@ -98,7 +98,7 @@ subtest 'set_password() (authorized user tests)' => sub { $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); - $t->request_ok($tx)->status_is(400)->json_is({ error => 'Password is too weak' }); + $t->request_ok($tx)->status_is(400)->json_is({ error => '[Password is too weak]' }); $new_password = 'ABcde123%&'; $tx -- 2.19.0