Skip to content

Commit

Permalink
Merge pull request #814 from hargata/Hargata/805.2
Browse files Browse the repository at this point in the history
streamline token generation process.
  • Loading branch information
hargata authored Jan 20, 2025
2 parents e26869b + 905ee9b commit a23b02e
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions wwwroot/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: `
<input type="text" id="inputTokenEmail" class="swal2-input" placeholder="Email Address" onkeydown="handleSwalEnter(event)">
`,
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);
}
});
}
});
}

0 comments on commit a23b02e

Please sign in to comment.