View | Details | Raw Unified | Return to bug 28787
Collapse All | Expand All

(-)a/Koha/REST/V1/Auth.pm (-1 / +1 lines)
Lines 288-294 sub authenticate_api_request { Link Here
288
        return 1;
288
        return 1;
289
    }
289
    }
290
    else {
290
    else {
291
        # We are required authorizarion, there needs
291
        # We are required authorization, there needs
292
        # to be an identified user
292
        # to be an identified user
293
        Koha::Exceptions::Authentication::Required->throw(
293
        Koha::Exceptions::Authentication::Required->throw(
294
            error => 'Authentication failure.' )
294
            error => 'Authentication failure.' )
(-)a/t/db_dependent/api/v1/two_factor_auth.t (-7 / +9 lines)
Lines 43-49 $mocked_koha_email->mock( 'send_or_die', sub { Link Here
43
43
44
subtest 'send_otp_token' => sub {
44
subtest 'send_otp_token' => sub {
45
45
46
    plan tests => 9;
46
    plan tests => 11;
47
47
48
    $schema->storage->txn_begin;
48
    $schema->storage->txn_begin;
49
49
Lines 73-83 subtest 'send_otp_token' => sub { Link Here
73
    $session->param('waiting-for-2FA', 1);
73
    $session->param('waiting-for-2FA', 1);
74
    $session->flush;
74
    $session->flush;
75
75
76
    $session = C4::Auth::get_session($session->id);
77
78
    my $auth = Test::MockModule->new("C4::Auth");
79
    $auth->mock('check_cookie_auth', sub { return 'additional-auth-needed'});
80
81
    $patron->library->set(
76
    $patron->library->set(
82
        {
77
        {
83
            branchemail      => 'from@example.org',
78
            branchemail      => 'from@example.org',
Lines 105-110 subtest 'send_otp_token' => sub { Link Here
105
    # Everything is ok, the email will be sent
100
    # Everything is ok, the email will be sent
106
    $t->request_ok($tx)->status_is(200);
101
    $t->request_ok($tx)->status_is(200);
107
102
103
    # Change flags: not enough authorization anymore
104
    $patron->flags(16)->store;
105
    $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" );
106
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
107
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
108
    $t->request_ok($tx)->status_is(403);
109
    $patron->flags(20)->store;
110
108
    $session->param('waiting-for-2FA', 0);
111
    $session->param('waiting-for-2FA', 0);
109
    $session->flush;
112
    $session->flush;
110
    $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" );
113
    $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" );
111
- 

Return to bug 28787