Lines 57-64
subtest 'send_otp_token' => sub {
Link Here
|
57 |
); |
57 |
); |
58 |
|
58 |
|
59 |
my $session = C4::Auth::get_session(''); |
59 |
my $session = C4::Auth::get_session(''); |
60 |
$session->param( 'number', $patron->borrowernumber ); |
|
|
61 |
$session->param( 'id', $patron->userid ); |
62 |
$session->param( 'ip', '127.0.0.1' ); |
60 |
$session->param( 'ip', '127.0.0.1' ); |
63 |
$session->param( 'lasttime', time() ); |
61 |
$session->param( 'lasttime', time() ); |
64 |
$session->flush; |
62 |
$session->flush; |
Lines 70-75
subtest 'send_otp_token' => sub {
Link Here
|
70 |
# Patron is not authenticated yet |
68 |
# Patron is not authenticated yet |
71 |
$t->request_ok($tx)->status_is(401); |
69 |
$t->request_ok($tx)->status_is(401); |
72 |
|
70 |
|
|
|
71 |
# Patron is partially authenticated (credentials correct) |
72 |
$session->param( 'number', $patron->borrowernumber ); |
73 |
$session->param( 'id', $patron->userid ); |
73 |
$session->param('waiting-for-2FA', 1); |
74 |
$session->param('waiting-for-2FA', 1); |
74 |
$session->flush; |
75 |
$session->flush; |
75 |
|
76 |
|
Lines 108-113
subtest 'send_otp_token' => sub {
Link Here
|
108 |
$t->request_ok($tx)->status_is(403); |
109 |
$t->request_ok($tx)->status_is(403); |
109 |
$patron->flags(20)->store; |
110 |
$patron->flags(20)->store; |
110 |
|
111 |
|
|
|
112 |
# Patron is fully authenticated, cannot request a token again |
111 |
$session->param('waiting-for-2FA', 0); |
113 |
$session->param('waiting-for-2FA', 0); |
112 |
$session->flush; |
114 |
$session->flush; |
113 |
$tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" ); |
115 |
$tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" ); |
114 |
- |
|
|