Skip to content

Commit

Permalink
fix: login security issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pbc1017 committed Mar 20, 2024
1 parent 94f7e44 commit 47ca067
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions back/routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ router.post("/", async (req, res) => {
});

router.get("/", async (req, res) => {
const { student_id } = req.session.user;

try {
const { student_id } = req.session.user;

const member = await Member.findOne({
where: { student_id },
});
Expand Down
12 changes: 9 additions & 3 deletions front/src/pages/home/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,21 @@ export const Home = (): JSX.Element => {
const loginInfo = JSON.parse(loginInfoStr);

try {
console.log(loginInfo);
await postRequest("user", loginInfo, () => {});
await postRequest(
"user",
loginInfo,
() => {},
() => {
alert("로그아웃 후 KAIST 계정으로 다시 로그인해주시기 바랍니다.");
window.location.href = "https://sso.sparcs.org";
}
);
await getRequest("user", (data) => {
login(data);
});
navigate("/");
} catch (error) {
console.error(error);
logout();
}
}
};
Expand Down

0 comments on commit 47ca067

Please sign in to comment.