Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return res.send({
success: false,
message: "Wrong ID or email",
});
const userExists = await User.findOne({
pid: req.body.pid,
});
if (userExists)
return res.send({
success: false,
message: "Already exists",
});
const token = uuid();
const user = new User({
pid: req.body.pid,
email: req.body.email,
secret: req.body.secret,
token,
});
sendEmail(
`
<h1>You have successfully registered</h1>
<p>Here is your token: <b>${token}</b></p>
<p>Use it to login into our <a href="https://t.me/nu_headhunter_bot">Telegram bot</a></p>
app.use((req, res, next) => {
res.locals.nonce = Buffer.from(uuid()).toString('base64');
next();
});
app.use(helmet.contentSecurityPolicy({