Lines 150-156
subtest 'checkauth() tests' => sub {
Link Here
|
150 |
$logout = 0; |
150 |
$logout = 0; |
151 |
} |
151 |
} |
152 |
|
152 |
|
153 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 0 ); |
153 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'disabled' ); |
154 |
$patron->auth_method('password')->store; |
154 |
$patron->auth_method('password')->store; |
155 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'intranet' ); |
155 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'intranet' ); |
156 |
is( $userid, $patron->userid, 'Succesful login' ); |
156 |
is( $userid, $patron->userid, 'Succesful login' ); |
Lines 163-169
subtest 'checkauth() tests' => sub {
Link Here
|
163 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'Second auth not required' ); |
163 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'Second auth not required' ); |
164 |
logout($cgi); |
164 |
logout($cgi); |
165 |
|
165 |
|
166 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 1 ); |
166 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'enabled' ); |
167 |
t::lib::Mocks::mock_config('encryption_key', '1234tH1s=t&st'); |
167 |
t::lib::Mocks::mock_config('encryption_key', '1234tH1s=t&st'); |
168 |
$patron->auth_method('password')->store; |
168 |
$patron->auth_method('password')->store; |
169 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'intranet' ); |
169 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'intranet' ); |
Lines 193-199
subtest 'checkauth() tests' => sub {
Link Here
|
193 |
is( $userid, $patron->userid, 'Succesful login' ); |
193 |
is( $userid, $patron->userid, 'Succesful login' ); |
194 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), 0, 'Second auth no longer required if OTP token has been verified' ); |
194 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), 0, 'Second auth no longer required if OTP token has been verified' ); |
195 |
|
195 |
|
196 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 0 ); |
196 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'disabled' ); |
197 |
}; |
197 |
}; |
198 |
|
198 |
|
199 |
C4::Context->_new_userenv; # For next tests |
199 |
C4::Context->_new_userenv; # For next tests |