Login Invite
Login invite script in logininvite.ejs
This commit is contained in:
parent
87e7673513
commit
61f74c0d44
@ -331,15 +331,15 @@ router.post("/maninvite", async (req, res) => {
|
||||
res.status(200).send(postgres.manInvite(req.body.sl_id, uid));
|
||||
}
|
||||
catch(err) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
}
|
||||
}).catch(function(error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
});
|
||||
});
|
||||
|
||||
router.get("/invite/", async (req, res) => {
|
||||
res.status(200).send("userid");
|
||||
router.get("/invite/:invitelink", async (req, res) => {
|
||||
res.status(200).render("invitelogin", {invitelink: req.params.invitelink});
|
||||
});
|
||||
|
||||
|
||||
|
56
express-server/views/invitelogin.ejs
Normal file
56
express-server/views/invitelogin.ejs
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
<script src="https://www.gstatic.com/firebasejs/5.7.0/firebase.js"></script>
|
||||
<script>
|
||||
// Initialize Firebase
|
||||
var config = {
|
||||
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
|
||||
authDomain: "test-667ca.firebaseapp.com",
|
||||
databaseURL: "https://test-667ca.firebaseio.com",
|
||||
projectId: "test-667ca",
|
||||
storageBucket: "test-667ca.appspot.com",
|
||||
messagingSenderId: "221332577314"
|
||||
};
|
||||
firebase.initializeApp(config);
|
||||
|
||||
function checkAuth() {
|
||||
firebase.auth().onAuthStateChanged(async function (user) {
|
||||
if (user) {
|
||||
try {
|
||||
firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (
|
||||
idToken) {
|
||||
console.log("Vor Replace");
|
||||
window.location.replace("/invite/" + idToken + "/" + invitelink);
|
||||
}).catch(function (error) {
|
||||
console.error("Get id token client error: ", error)
|
||||
});
|
||||
} catch {
|
||||
console.error("checkAuth error: ")
|
||||
}
|
||||
|
||||
// document.getElementById("loginbutton").style.display = "none";
|
||||
//
|
||||
} else {
|
||||
// document.getElementById("loginbutton").style.display = "block";
|
||||
console.log("Check Auth error", user)
|
||||
}
|
||||
})
|
||||
var user = firebase.auth().currentUser;
|
||||
}
|
||||
window.onload = function () {
|
||||
checkAuth();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user