Skip to content

Commit

Permalink
why do i do this to myself, i need to make more commits jesus
Browse files Browse the repository at this point in the history
  • Loading branch information
MattheousDT committed Aug 28, 2018
1 parent 0774b52 commit 47f5e84
Show file tree
Hide file tree
Showing 37 changed files with 2,622 additions and 1,360 deletions.
18 changes: 9 additions & 9 deletions src/web/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ router.get("/auth/discord", async (req, res) => {
} catch(error) {

apiLogger.error(error);
res.json({ status: 401, message: "Unauthorized", error });
res.render("401", { status: 401, message: "Unauthorized", error });
}

res.cookie("session", jwt.sign({ id: new_session_doc._id }, config.jwt_secret), config.rawrxd, { maxAge: 604800, expire: new Date() + 604800, secure: true });
Expand All @@ -231,11 +231,11 @@ router.get("/auth/discord/callback", async (req, res) => {
} catch(error) {

apiLogger.error(error);
return res.json({ status: 401, message: "Unauthorized", error });
return res.render("401", { status: 401, message: "Unauthorized", error });
}

if (session_doc.nonce !== req.query.state) {
return res.json({ status: 401, message: "Unauthorized", error: "Login state was incorrect" });
return res.render("401", { status: 401, message: "Unauthorized", error: "Login state was incorrect" });
}

let token_res;
Expand All @@ -251,7 +251,7 @@ router.get("/auth/discord/callback", async (req, res) => {
} catch(error) {

apiLogger.error(error);
return res.json({ status: 401, message: "Unauthorized", error });
return res.render("401", { status: 401, message: "Unauthorized", error });
}

let user_res;
Expand All @@ -267,7 +267,7 @@ router.get("/auth/discord/callback", async (req, res) => {
} catch(error) {

apiLogger.error(error);
return res.json({ status: 401, message: "Unauthorized", error });
return res.render("401", { status: 401, message: "Unauthorized", error });
}

session_doc.discord.access_token = token_res.data.access_token;
Expand All @@ -287,7 +287,7 @@ router.get("/auth/discord/callback", async (req, res) => {
} catch(error) {

apiLogger.error(error);
return res.json({ status: 401, message: "Unauthorized", error });
return res.render("401", { status: 401, message: "Unauthorized", error });
}

res.redirect("/dashboard");
Expand Down Expand Up @@ -478,7 +478,7 @@ router.get("/dashboard/scripts/manager", authUser, async (req, res) => {
res.render("dashboard/scriptmanager", { user_data: user_res.data });
});

router.get("/dashboard/patrons/getawesomo", authUser, async (req, res) => {
router.get("/dashboard/patrons", authUser, async (req, res) => {

let user_res;
try {
Expand All @@ -496,7 +496,7 @@ router.get("/dashboard/patrons/getawesomo", authUser, async (req, res) => {
return res.json({ error: "error fetching discord data lol" });
}

res.render("dashboard/patron-steps", { user_data: user_res.data });
res.render("dashboard/patrons", { user_data: user_res.data });
});

router.get("/dragonsplayroom", authUser, async (req, res) => {
Expand Down Expand Up @@ -527,7 +527,7 @@ router.get("/dragonsplayroompp", authUser, (req, res) => {

router.get("/token", authAdmin, (req, res) => {

res.json({ token: req.cookies.session });
res.render("token", { token: req.cookies.session });
});

module.exports = router;

0 comments on commit 47f5e84

Please sign in to comment.