|
Lines 195-216
Link Here
|
| 195 |
|
195 |
|
| 196 |
$("#send_otp").on("click", function(e){ |
196 |
$("#send_otp").on("click", function(e){ |
| 197 |
e.preventDefault(); |
197 |
e.preventDefault(); |
|
|
198 |
[% UNLESS notice_email_address %] |
| 199 |
alert("Cannot send the notice, you don't have an email address defined.") |
| 200 |
[% ELSE %] |
| 198 |
$("#email_success").hide(); |
201 |
$("#email_success").hide(); |
| 199 |
$("#email_error").hide(); |
202 |
$("#email_error").hide(); |
| 200 |
$.ajax({ |
203 |
$.ajax({ |
| 201 |
url: '/api/v1/auth/otp/token_delivery', |
204 |
url: '/api/v1/auth/otp/token_delivery', |
| 202 |
type: 'POST', |
205 |
type: 'POST', |
| 203 |
success: function(data){ |
206 |
success: function(data){ |
| 204 |
let message = _("The code has been sent by email, please check your inbox.") |
207 |
let message = _("The code has been sent by email, please check your inbox.") |
| 205 |
$("#email_success").show().html(message); |
208 |
$("#email_success").show().html(message); |
| 206 |
}, |
209 |
}, |
| 207 |
error: function(data){ |
210 |
error: function(data){ |
| 208 |
let error = data.responseJSON && data.responseJSON.error == "email_not_sent" |
211 |
let error = data.responseJSON && data.responseJSON.error == "email_not_sent" |
| 209 |
? _("Email not sent, maybe you don't have an email address defined?") |
212 |
? _("Email not sent, please contact the Koha administrator") |
| 210 |
: _("Email not sent"); |
213 |
: _("Something wrong happened, please contact the Koha administrator"); |
| 211 |
$("#email_error").show().html(error); |
214 |
$("#email_error").show().html(error); |
| 212 |
} |
215 |
} |
| 213 |
}); |
216 |
}); |
|
|
217 |
[% END %] |
| 214 |
}); |
218 |
}); |
| 215 |
}); |
219 |
}); |
| 216 |
</script> |
220 |
</script> |
| 217 |
- |
|
|