Bugzilla – Attachment 138702 Details for
Bug 28787
Send a notice with the TOTP token
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28787: Don't request a token if no email address defined
Bug-28787-Dont-request-a-token-if-no-email-address.patch (text/plain), 3.52 KB, created by
Kyle M Hall (khall)
on 2022-08-05 14:24:58 UTC
(
hide
)
Description:
Bug 28787: Don't request a token if no email address defined
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-08-05 14:24:58 UTC
Size:
3.52 KB
patch
obsolete
>From c1ab903b5e735746d3c4454ecc323e55cca2361f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 8 Jul 2022 08:53:22 +0200 >Subject: [PATCH] Bug 28787: Don't request a token if no email address defined > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Sponsored-by: Rijksmuseum, Netherlands > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Auth.pm | 2 ++ > .../intranet-tmpl/prog/en/modules/auth.tt | 32 +++++++++++-------- > 2 files changed, 20 insertions(+), 14 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 0e9e1d23a5e..7cf4c9dbc8d 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1415,9 +1415,11 @@ sub checkauth { > $template->param( OpacPublic => C4::Context->preference("OpacPublic") ); > $template->param( loginprompt => 1 ) unless $info{'nopermission'}; > if ( $auth_state eq 'additional-auth-needed' ) { >+ my $patron = Koha::Patrons->find( { userid => $userid } ); > $template->param( > TwoFA_prompt => 1, > invalid_otp_token => $invalid_otp_token, >+ notice_email_address => $patron->notice_email_address, # We could also pass logged_in_user if necessary > ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >index 41995bf423a..e2db5e0f30a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >@@ -195,22 +195,26 @@ > > $("#send_otp").on("click", function(e){ > e.preventDefault(); >+ [% UNLESS notice_email_address %] >+ alert("Cannot send the notice, you don't have an email address defined.") >+ [% ELSE %] > $("#email_success").hide(); > $("#email_error").hide(); >- $.ajax({ >- url: '/api/v1/auth/otp/token_delivery', >- type: 'POST', >- success: function(data){ >- let message = _("The code has been sent by email, please check your inbox.") >- $("#email_success").show().html(message); >- }, >- error: function(data){ >- let error = data.responseJSON && data.responseJSON.error == "email_not_sent" >- ? _("Email not sent, maybe you don't have an email address defined?") >- : _("Email not sent"); >- $("#email_error").show().html(error); >- } >- }); >+ $.ajax({ >+ url: '/api/v1/auth/otp/token_delivery', >+ type: 'POST', >+ success: function(data){ >+ let message = _("The code has been sent by email, please check your inbox.") >+ $("#email_success").show().html(message); >+ }, >+ error: function(data){ >+ let error = data.responseJSON && data.responseJSON.error == "email_not_sent" >+ ? _("Email not sent, please contact the Koha administrator") >+ : _("Something wrong happened, please contact the Koha administrator"); >+ $("#email_error").show().html(error); >+ } >+ }); >+ [% END %] > }); > }); > </script> >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28787
:
135287
|
136571
|
136572
|
136573
|
137251
|
137330
|
137331
|
137369
|
137370
|
137371
|
137379
|
137380
|
137381
|
137391
|
137392
|
137393
|
137394
|
137395
|
137396
|
137397
|
137398
|
137399
|
137400
|
138146
|
138149
|
138150
|
138151
|
138152
|
138153
|
138154
|
138155
|
138156
|
138157
|
138158
|
138159
|
138689
|
138696
|
138697
|
138698
|
138699
|
138700
|
138701
| 138702 |
138703
|
138704
|
138705
|
138706
|
138707
|
138931
|
138932