|
Lines 190-196
subtest 'checkauth() tests' => sub {
Link Here
|
| 190 |
$logout = 0; |
190 |
$logout = 0; |
| 191 |
} |
191 |
} |
| 192 |
|
192 |
|
| 193 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 0 ); |
193 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'disabled' ); |
| 194 |
$patron->auth_method('password')->store; |
194 |
$patron->auth_method('password')->store; |
| 195 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'intranet' ); |
195 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'intranet' ); |
| 196 |
is( $userid, $patron->userid, 'Succesful login' ); |
196 |
is( $userid, $patron->userid, 'Succesful login' ); |
|
Lines 203-209
subtest 'checkauth() tests' => sub {
Link Here
|
| 203 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'Second auth not required' ); |
203 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'Second auth not required' ); |
| 204 |
logout($cgi); |
204 |
logout($cgi); |
| 205 |
|
205 |
|
| 206 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 1 ); |
206 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'enabled' ); |
| 207 |
t::lib::Mocks::mock_config('encryption_key', '1234tH1s=t&st'); |
207 |
t::lib::Mocks::mock_config('encryption_key', '1234tH1s=t&st'); |
| 208 |
$patron->auth_method('password')->store; |
208 |
$patron->auth_method('password')->store; |
| 209 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'intranet' ); |
209 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired', undef, 'intranet' ); |
|
Lines 238-244
subtest 'checkauth() tests' => sub {
Link Here
|
| 238 |
is( $userid, $patron->userid, 'Succesful login at the OPAC' ); |
238 |
is( $userid, $patron->userid, 'Succesful login at the OPAC' ); |
| 239 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'No second auth required at the OPAC' ); |
239 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'No second auth required at the OPAC' ); |
| 240 |
|
240 |
|
| 241 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 0 ); |
241 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'disabled' ); |
| 242 |
}; |
242 |
}; |
| 243 |
|
243 |
|
| 244 |
C4::Context->_new_userenv; # For next tests |
244 |
C4::Context->_new_userenv; # For next tests |