|
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 198-204
subtest 'checkauth() tests' => sub {
Link Here
|
| 198 |
is( $userid, $patron->userid, 'Succesful login at the OPAC' ); |
198 |
is( $userid, $patron->userid, 'Succesful login at the OPAC' ); |
| 199 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'No second auth required at the OPAC' ); |
199 |
is( C4::Auth::get_session($sessionID)->param('waiting-for-2FA'), undef, 'No second auth required at the OPAC' ); |
| 200 |
|
200 |
|
| 201 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 0 ); |
201 |
t::lib::Mocks::mock_preference( 'TwoFactorAuthentication', 'disabled' ); |
| 202 |
}; |
202 |
}; |
| 203 |
|
203 |
|
| 204 |
C4::Context->_new_userenv; # For next tests |
204 |
C4::Context->_new_userenv; # For next tests |