change logout to 30 days
This commit is contained in:
parent
d2e50dccd1
commit
d30c0921cf
@ -111,7 +111,7 @@ function setupRoutes() {
|
|||||||
const isMatch = await bcrypt.compare(password, user.password);
|
const isMatch = await bcrypt.compare(password, user.password);
|
||||||
if (!isMatch) return res.status(401).json({ message: "Invalid credentials." });
|
if (!isMatch) return res.status(401).json({ message: "Invalid credentials." });
|
||||||
const tokenPayload = { id: user.id, username: user.username, role: user.role };
|
const tokenPayload = { id: user.id, username: user.username, role: user.role };
|
||||||
const token = jwt.sign(tokenPayload, JWT_SECRET, { expiresIn: '8h' });
|
const token = jwt.sign(tokenPayload, JWT_SECRET, { expiresIn: '30d' });
|
||||||
res.json({ token, user: tokenPayload });
|
res.json({ token, user: tokenPayload });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
res.status(500).json({ message: "Server error during login." });
|
res.status(500).json({ message: "Server error during login." });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user