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

(-)a/Koha/REST/V1/Auth.pm (-1 / +1 lines)
Lines 231-237 sub authenticate_api_request { Link Here
231
            $cookie_auth = 1;
231
            $cookie_auth = 1;
232
        }
232
        }
233
        elsif ($status eq "additional-auth-needed") {
233
        elsif ($status eq "additional-auth-needed") {
234
            if ( $c->req->url->to_abs->path eq '/api/v1/auth/send_otp_token' ) {
234
            if ( $c->req->url->to_abs->path eq '/api/v1/auth/otp/token_delivery' ) {
235
                $user = Koha::Patrons->find( $session->param('number') );
235
                $user = Koha::Patrons->find( $session->param('number') );
236
                $cookie_auth = 1;
236
                $cookie_auth = 1;
237
            } else {
237
            } else {
(-)a/api/v1/swagger/paths/auth.yaml (-1 / +1 lines)
Lines 1-5 Link Here
1
---
1
---
2
/auth/send_otp_token:
2
/auth/otp/token_delivery:
3
  post:
3
  post:
4
    x-mojo-to: TwoFactorAuth#send_otp_token
4
    x-mojo-to: TwoFactorAuth#send_otp_token
5
    operationId: send_otp_token
5
    operationId: send_otp_token
(-)a/api/v1/swagger/swagger.yaml (-2 / +2 lines)
Lines 101-108 paths: Link Here
101
    $ref: "./paths/advancededitormacros.yaml#/~1advanced_editor~1macros~1{advancededitormacro_id}"
101
    $ref: "./paths/advancededitormacros.yaml#/~1advanced_editor~1macros~1{advancededitormacro_id}"
102
  "/article_requests/{article_request_id}":
102
  "/article_requests/{article_request_id}":
103
    $ref: "./paths/article_requests.yaml#/~1article_requests~1{article_request_id}"
103
    $ref: "./paths/article_requests.yaml#/~1article_requests~1{article_request_id}"
104
  /auth/send_otp_token:
104
  /auth/otp/token_delivery:
105
    $ref: paths/auth.yaml#/~1auth~1send_otp_token
105
    $ref: paths/auth.yaml#/~1auth~1otp~1token_delivery
106
  "/biblios/{biblio_id}":
106
  "/biblios/{biblio_id}":
107
    $ref: "./paths/biblios.yaml#/~1biblios~1{biblio_id}"
107
    $ref: "./paths/biblios.yaml#/~1biblios~1{biblio_id}"
108
  "/biblios/{biblio_id}/checkouts":
108
  "/biblios/{biblio_id}/checkouts":
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt (-1 / +1 lines)
Lines 198-204 Link Here
198
                $("#email_success").hide();
198
                $("#email_success").hide();
199
                $("#email_error").hide();
199
                $("#email_error").hide();
200
                $.ajax({
200
                $.ajax({
201
                    url: '/api/v1/auth/send_otp_token',
201
                    url: '/api/v1/auth/otp/token_delivery',
202
                    type: 'POST',
202
                    type: 'POST',
203
                    success: function(data){
203
                    success: function(data){
204
                        let message = _("The code has been sent by email, please check your inbox.")
204
                        let message = _("The code has been sent by email, please check your inbox.")
(-)a/t/db_dependent/api/v1/two_factor_auth.t (-4 / +3 lines)
Lines 58-64 subtest 'send_otp_token' => sub { Link Here
58
    $session->param( 'lasttime', time() );
58
    $session->param( 'lasttime', time() );
59
    $session->flush;
59
    $session->flush;
60
60
61
    my $tx = $t->ua->build_tx( POST => "/api/v1/auth/send_otp_token" );
61
    my $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" );
62
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
62
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
63
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
63
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
64
64
Lines 85-91 subtest 'send_otp_token' => sub { Link Here
85
    $patron->email(undef);
85
    $patron->email(undef);
86
    $patron->store;
86
    $patron->store;
87
87
88
    $tx = $t->ua->build_tx( POST => "/api/v1/auth/send_otp_token" );
88
    $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" );
89
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
89
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
90
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
90
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
91
91
Lines 93-99 subtest 'send_otp_token' => sub { Link Here
93
    $t->request_ok($tx)->status_is(400)->json_is({ error => 'email_not_sent' });
93
    $t->request_ok($tx)->status_is(400)->json_is({ error => 'email_not_sent' });
94
94
95
    $patron->email('to@example.org')->store;
95
    $patron->email('to@example.org')->store;
96
    $tx = $t->ua->build_tx( POST => "/api/v1/auth/send_otp_token" );
96
    $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" );
97
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
97
    $tx->req->cookies( { name => 'CGISESSID', value => $session->id } );
98
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
98
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
99
99
100
- 

Return to bug 28787