Untitled
unknown
plain_text
3 years ago
452 B
16
Indexable
app.post('/register', express.urlencoded(), async(req, res, next) => {
const hashedPass = genPassword(req.body.password);
try {
const newUser = new User({
username: req.body.username,
email: req.body.email,
password: hashedPass,
admin: true
})
newUser.save();
} catch (e) {
console.error(e);
}
res.redirect('/login');
});
Editor is loading...