Skip to content

Commit

Permalink
mansar.io
Browse files Browse the repository at this point in the history
  • Loading branch information
MuneebAnsari committed Apr 23, 2024
1 parent 56df9da commit 12ec346
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions verifyemail/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
return urlParams.get("state");
}

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

function getSessionToken() {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get("session_token");
Expand All @@ -115,42 +120,33 @@
document.body.appendChild(iframe);
}

function logoutCallback() {
window.location.href =
"com.etr407.ciam.androidharness://login.mansar.io/custom/logout";
}

function signupCallback() {
window.location.href =
"com.etr407.ciam.androidharness://login.mansar.io/custom/signup";
const clientId = getClientId();
if (clientId === "pLK2iHJcGqsVi01iY1lMUHrYD3jHTse") {
window.location.href =
"com.etr407.ciam.androidharness://login.mansar.io/custom/signup";
} else {
alert("BAD CLIENT ID");
}
}

function loginCallback() {
window.location.href =
"com.etr407.ciam.androidharness://login.mansar.io/custom/login";
const clientId = getClientId();
if (clientId === "pLK2iHJcGqsVi01iY1lMUHrYD3jHTse") {
window.location.href =
"com.etr407.ciam.androidharness://login.mansar.io/custom/login";
} else {
alert("BAD CLIENT ID");
}
}

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

// async function importKey(data) {
// var key = await crypto.subtle.importKey(
// "raw",
// new TextEncoder().encode(data),
// {
// name: "HMAC",
// hash: { name: "SHA-512" },
// },
// false,
// ["sign", "verify"]
// );
// return key;
// }

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

0 comments on commit 12ec346

Please sign in to comment.