Fixing signup

This commit is contained in:
Selim Mustafaev 2023-09-06 20:35:21 +03:00
parent c554e1750e
commit e0f7740bc3

View File

@ -13,7 +13,7 @@ router.post('/signup', async (req, res) => {
if(users.length == 0) {
let user = new User(email, password);
await collection.insertOne(user.toDB());
user.token = jwt.sign({ email }, '#IWantToBelieve', { expiresIn: '365d' });
user.token = jwt.sign({ email }, process.env.JWT_SECRET_AUTH, { expiresIn: process.env.JWT_EXPIRATION_TIME });
res.send({ success: true, data: user });
} else {
res.send(makeError('User already exists'));