user.save().then(() => {
                            req.login(user, function (error) {
                                if (error) {
                                    /* istanbul ignore next */
                                    res.status(400).error(error);