Lines 146-164
elsif ( $query->param('passwordReset') ) {
Link Here
|
146 |
} elsif ( $password ne $repeatPassword ) { |
146 |
} elsif ( $password ne $repeatPassword ) { |
147 |
$error = 'errPassNotMatch'; |
147 |
$error = 'errPassNotMatch'; |
148 |
} else { |
148 |
} else { |
149 |
my ( $is_valid, $err) = Koha::AuthUtils::is_password_valid( $password ); |
149 |
try { |
150 |
unless ( $is_valid ) { |
150 |
Koha::Patrons->find($borrower_number)->set_password( $password ); |
151 |
$error = 'password_too_short' if $err eq 'too_short'; |
151 |
|
152 |
$error = 'password_too_weak' if $err eq 'too_weak'; |
|
|
153 |
$error = 'password_has_whitespaces' if $err eq 'has_whitespaces'; |
154 |
} else { |
155 |
Koha::Patrons->find($borrower_number)->update_password( $username, $password ); |
156 |
CompletePasswordRecovery($uniqueKey); |
152 |
CompletePasswordRecovery($uniqueKey); |
157 |
$template->param( |
153 |
$template->param( |
158 |
password_reset_done => 1, |
154 |
password_reset_done => 1, |
159 |
username => $username |
155 |
username => $username |
160 |
); |
156 |
); |
161 |
} |
157 |
} |
|
|
158 |
catch { |
159 |
if ( $_->isa('Koha::Exceptions::Password::TooShort') ) { |
160 |
$error = 'password_too_short'; |
161 |
} |
162 |
elsif ( $_->isa('Koha::Exceptions::Password::WhitespaceCharacters') ) { |
163 |
$error = 'password_has_whitespaces'; |
164 |
} |
165 |
elsif ( $_->isa('Koha::Exceptions::Password::TooWeak') ) { |
166 |
$error = 'password_too_weak'; |
167 |
} |
168 |
}; |
162 |
} |
169 |
} |
163 |
if ( $error ) { |
170 |
if ( $error ) { |
164 |
$template->param( |
171 |
$template->param( |
165 |
- |
|
|