Skip to content

Commit

Permalink
expires in 9h
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishektiwari47 committed Dec 4, 2023
1 parent 963fb97 commit 046838e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/server/dist/routes/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ router.post('/login', (req, res) => __awaiter(void 0, void 0, void 0, function*
const { username, password } = req.body;
const user = yield db_1.User.findOne({ username, password });
if (user) {
const token = jsonwebtoken_1.default.sign({ id: user._id }, index_1.SECRET, { expiresIn: '1h' });
const token = jsonwebtoken_1.default.sign({ id: user._id }, index_1.SECRET, { expiresIn: '9h' });
res.json({ message: 'Logged in successfully', token });
}
else {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/routes/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ router.post('/signup', async (req, res) => {
const { username, password } = req.body;
const user = await User.findOne({ username, password });
if (user) {
const token = jwt.sign({ id: user._id }, SECRET, { expiresIn: '1h' });
const token = jwt.sign({ id: user._id }, SECRET, { expiresIn: '9h' });
res.json({ message: 'Logged in successfully', token });
} else {
res.status(403).json({ message: 'Invalid username or password' });
Expand Down

0 comments on commit 046838e

Please sign in to comment.