Lines 153-158
subtest 'checkauth() tests' => sub {
Link Here
|
153 |
}; |
153 |
}; |
154 |
|
154 |
|
155 |
subtest 'Two-factor authentication' => sub { |
155 |
subtest 'Two-factor authentication' => sub { |
|
|
156 |
plan tests => 18; |
156 |
|
157 |
|
157 |
my $patron = $builder->build_object( |
158 |
my $patron = $builder->build_object( |
158 |
{ class => 'Koha::Patrons', value => { flags => 1 } } ); |
159 |
{ class => 'Koha::Patrons', value => { flags => 1 } } ); |
Lines 245-251
subtest 'checkauth() tests' => sub {
Link Here
|
245 |
is( $userid, $patron->userid, 'Succesful login at the OPAC' ); |
246 |
is( $userid, $patron->userid, 'Succesful login at the OPAC' ); |
246 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'No second auth required at the OPAC' ); |
247 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'No second auth required at the OPAC' ); |
247 |
|
248 |
|
|
|
249 |
# |
248 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'disabled' ); |
250 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'disabled' ); |
|
|
251 |
$session = C4::Auth::get_session($sessionID); |
252 |
$session->param('waiting-for-2FA', 1); |
253 |
$session->flush; |
254 |
my ($auth_status, undef ) = C4::Auth::check_cookie_auth($sessionID, undef ); |
255 |
is( $auth_status, 'ok', 'User authenticated, pref was disabled, access OK' ); |
256 |
$session->param('waiting-for-2FA', 0); |
257 |
$session->param('waiting-for-2FA-setup', 1); |
258 |
$session->flush; |
259 |
($auth_status, undef ) = C4::Auth::check_cookie_auth($sessionID, undef ); |
260 |
is( $auth_status, 'ok', 'User waiting for 2FA setup, pref was disabled, access OK' ); |
249 |
}; |
261 |
}; |
250 |
|
262 |
|
251 |
C4::Context->_new_userenv; # For next tests |
263 |
C4::Context->_new_userenv; # For next tests |
252 |
- |
|
|