Skip to content

Commit

Permalink
mansar.io
Browse files Browse the repository at this point in the history
  • Loading branch information
MuneebAnsari committed Apr 22, 2024
1 parent adb376d commit 56df9da
Showing 1 changed file with 15 additions and 35 deletions.
50 changes: 15 additions & 35 deletions verifyemail/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,45 +88,22 @@
return params;
}

// function showContainer(message, status) {
// const container = document.querySelector(".container");
// const continueButton = document.createElement("button");
// continueButton.textContent = "Continue";
// continueButton.onclick =
// status === "true" ? loginCallback : logoutCallback;
// const messageElement = document.createElement("p");
// messageElement.textContent = message;

// container.innerHTML = "";
// container.appendChild(messageElement);
// container.appendChild(continueButton);
// container.style.display = "block";
// }

// const queryParams = getQueryParams();
// if (queryParams.success === "true") {
// const message = queryParams.message || "Email Verification Successful";
// showContainer(message, queryParams.success);
// } else if (queryParams.success === "false") {
// const message = queryParams.message || "Email Verification Failed";
// showContainer(message, queryParams.success);
// } else {
// const container = document.querySelector(".container");
// container.style.display = "block";
// }

function getState() {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get("state");
}
function getEmail() {
return getQueryParams.email;
}

function getSessionToken() {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get("session_token");
}

function getEmailFromJwt(jwt) {
const payload = decodeJwt(jwt);
console.log(payload);
return payload.email;
}

async function goToContinueUri() {
// const receivedToken = getSessionToken();
// const updatedSessionToken = await updatedToken(receivedToken);
Expand Down Expand Up @@ -155,7 +132,9 @@

const queryParams = getQueryParams();
const message = document.getElementById("message");
message.innerText = `A verification email has been sent to ${queryParams.email}. Please follow the instructions
const sessionToken = getSessionToken();
const email = getEmailFromJwt(sessionToken);
message.innerText = `A verification email has been sent to ${email}. Please follow the instructions
in the email to complete the process.`;

// async function importKey(data) {
Expand All @@ -172,10 +151,11 @@
// return key;
// }

// function decodeJwt(token) {
// const payload = token.split(".")[1];
// return JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
// }
function decodeJwt(token) {
const payload = token.split(".")[1];
return JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
}

// async function updatedToken(receivedToken) {
// function base64urlEncode(str) {
// return btoa(str)
Expand Down

0 comments on commit 56df9da

Please sign in to comment.