Skip to content

Commit

Permalink
add login as user btn
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Jun 24, 2024
1 parent 750593d commit a9f8f65
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions apps/managment/editUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,20 @@ async function updateUser(e){
}

document.getElementById("updateBtn").addEventListener("click", updateUser);


function impUser(){
const urlParams = new URLSearchParams(window.location.search);
const emailAddr = urlParams.get('email');
fetch("../../data/User/impersonate", {"method":"post","body":JSON.stringify({"email":emailAddr})}).then(x=>x.json()).then(x=>{
console.log(x.token)
document.cookie = "token=" + x.token + "; path=/camic/htt";
document.cookie = "token=" + x.token + "; path=/camic_htt";
document.cookie = "token=" + x.token + "; path=//camic/htt";
document.cookie = "token=" + x.token + "; path=//camic_htt";
window.location = "../../";
})

}

document.getElementById("imp_btn").addEventListener("click", impUser);

0 comments on commit a9f8f65

Please sign in to comment.