diff --git a/wwwroot/js/login.js b/wwwroot/js/login.js index c4a3f56d..d7c8dd6a 100644 --- a/wwwroot/js/login.js +++ b/wwwroot/js/login.js @@ -69,16 +69,29 @@ function remoteLogin() { }) } function sendRegistrationToken() { - var userEmail = $("#inputEmail").val(); - if (userEmail.trim() == '') { - errorToast("No Email Address Provided"); - return; - } - $.post('/Login/SendRegistrationToken', { emailAddress: userEmail }, function (data) { - if (data.success) { - successToast(data.message); - } else { - errorToast(data.message); + Swal.fire({ + title: 'Please Provide an Email Address', + html: ` + + `, + confirmButtonText: 'Send', + focusConfirm: false, + preConfirm: () => { + const tokenEmail = $("#inputTokenEmail").val(); + if (!tokenEmail || tokenEmail.trim() == '') { + Swal.showValidationMessage(`Please enter a valid email address`); + } + return { tokenEmail } + }, + }).then(function (result) { + if (result.isConfirmed) { + $.post('/Login/SendRegistrationToken', { emailAddress: result.value.tokenEmail }, function (data) { + if (data.success) { + successToast(data.message); + } else { + errorToast(data.message); + } + }); } }); } \ No newline at end of file