Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (errors) {
- res.render('index', {
- errors: errors
- });
- } else {
- bcrypt.hash(newUser.password, saltRounds, function (err, hash) {
- if (err) {
- // console.log(err)
- } else {
- here
- Possibly unhandled rejection: <!DOCTYPE html>
- <html ng-app="mainApp">
- <head>
- <meta charset="utf-8">
- router.post('/create', function (req, res, next) {
- var newUser = {
- login: req.body.login,
- password: req.body.password,
- }
- req.checkBody('login', 'Login is required').notEmpty();
- req.checkBody('password', 'Password is required').notEmpty();
- var errors = req.validationErrors();
- if (errors) {
- res.render('index', {
- errors: errors
- });
- } else {
- bcrypt.hash(newUser.password, saltRounds, function (err, hash) {
- if (err) {
- // console.log(err)
- } else {
- newUser.password = hash;
- var user = new User(newUser);
- user.save()
- .then(function (User) {
- res.send(User);
- })
- .catch((err) => {
- console.log(err)
- })
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement