View | Details | Raw Unified | Return to bug 17006
Collapse All | Expand All

(-)a/Koha/REST/V1/Patrons/Password.pm (-3 / +2 lines)
Lines 100-110 sub set { Link Here
100
                    length => $password_length, min_length => $min_length );
100
                    length => $password_length, min_length => $min_length );
101
            }
101
            }
102
            elsif ( $error eq 'has_whitespaces' ) {
102
            elsif ( $error eq 'has_whitespaces' ) {
103
                Koha::Exceptions::Password::TrailingWhitespaces->throw(
103
                Koha::Exceptions::Password::WhitespaceCharacters->throw();
104
                    "Password contains trailing spaces, which is forbidden.");
105
            }
104
            }
106
            elsif ( $error eq 'too_weak' ) {
105
            elsif ( $error eq 'too_weak' ) {
107
                Koha::Exceptions::Password::TooWeak->throw("Password is too weak");
106
                Koha::Exceptions::Password::TooWeak->throw();
108
            }
107
            }
109
        }
108
        }
110
109
(-)a/t/db_dependent/api/v1/patrons_password.t (-3 / +2 lines)
Lines 78-84 subtest 'set_password() (authorized user tests)' => sub { Link Here
78
78
79
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
79
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
80
    $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } );
80
    $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } );
81
    $t->request_ok($tx)->status_is(400)->json_is({ error => 'Password contains trailing spaces, which is forbidden.' });
81
    $t->request_ok($tx)->status_is(400)->json_is({ error => '[Password contains leading/trailing whitespace character(s)]' });
82
82
83
    $new_password = 'abcdefg';
83
    $new_password = 'abcdefg';
84
    $tx
84
    $tx
Lines 98-104 subtest 'set_password() (authorized user tests)' => sub { Link Here
98
98
99
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
99
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
100
    $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } );
100
    $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } );
101
    $t->request_ok($tx)->status_is(400)->json_is({ error => 'Password is too weak' });
101
    $t->request_ok($tx)->status_is(400)->json_is({ error => '[Password is too weak]' });
102
102
103
    $new_password = 'ABcde123%&';
103
    $new_password = 'ABcde123%&';
104
    $tx
104
    $tx
105
- 

Return to bug 17006