feat(auth): oturum süresini 60 güne uzat
This commit is contained in:
@@ -26,12 +26,17 @@ router.post("/login", loginLimiter, async (req, res) => {
|
|||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: "lax",
|
sameSite: "lax",
|
||||||
secure: !isDev,
|
secure: !isDev,
|
||||||
|
maxAge: 60 * 24 * 60 * 60 * 1000,
|
||||||
});
|
});
|
||||||
return res.json({ username: user.username });
|
return res.json({ username: user.username });
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post("/logout", (_req, res) => {
|
router.post("/logout", (_req, res) => {
|
||||||
res.clearCookie("qbuffer_token");
|
res.clearCookie("qbuffer_token", {
|
||||||
|
httpOnly: true,
|
||||||
|
sameSite: "lax",
|
||||||
|
secure: !isDev,
|
||||||
|
});
|
||||||
return res.json({ ok: true });
|
return res.json({ ok: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const verifyCredentials = async (username: string, password: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const signToken = (payload: { username: string }) => {
|
export const signToken = (payload: { username: string }) => {
|
||||||
return jwt.sign(payload, config.jwtSecret, { expiresIn: "7d" });
|
return jwt.sign(payload, config.jwtSecret, { expiresIn: "60d" });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const verifyToken = (token: string) => {
|
export const verifyToken = (token: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user