Untitled
unknown
plain_text
8 months ago
512 B
2
Indexable
Never
// autenticacao const webToken = require('jsonwebtoken'); const { User } = require('../models'); const loginAuth = async (email, password) => { const user = await User.findOne({ where: { email } }); if (!user || user.password !== password) return null; const passwordWithoutHash = process.env.JWT_SECRET || 'raisfonogreis'; const token = webToken.sign( { id: user.id, email: user.email }, passwordWithoutHash, { expiresIn: '1d' }, ); return token; }; module.exports = { loginAuth, };
Leave a Comment