- Fixes for missing signup imports

This commit is contained in:
Mike Fitzpatrick
2019-08-17 02:47:31 -04:00
parent e475396c2c
commit 1936683f0e
4 changed files with 11 additions and 8 deletions

View File

@@ -5,13 +5,13 @@ const User = require('../models/user');
module.exports = function (server, auth) {
const { passport } = auth;
server.post('/signup', (req, res, next) => {
server.post('/signup', auth.basic, (req, res, next) => {
const { body: { user = null } = {} } = req;
let errors = {};
let errorCount = 0;
if (!user) {
errors.user = 'is required - can\'t make something from nothing...'';
errors.user = 'is required - can\'t make something from nothing...';
errorCount++;
}
@@ -27,7 +27,7 @@ module.exports = function (server, auth) {
if (info) {
res.send(200, {
success: false,
nextSteps: 'Please fix the problems indicated and try again.'
nextSteps: 'Please fix the problems indicated and try again.',
...info
});
@@ -36,14 +36,14 @@ module.exports = function (server, auth) {
res.send(200, {
success: true,
nextSteps: 'Check your email for our confirmation email, you will not be able to login without confirming.'
nextSteps: 'Check your email for our confirmation email, you will not be able to login without confirming.',
});
next();
});
});
server.get('/signup/validate/email/:email', (req, res, next) => {
server.get('/signup/validate/email/:email', auth.basic, (req, res, next) => {
const email = decodeURI(req.params.email);
User.findOne({ email }, (err, user) => {
@@ -56,7 +56,7 @@ module.exports = function (server, auth) {
});
});
server.get('/signup/validate/nom/:nom_de_bid', (req, res, next) => {
server.get('/signup/validate/nom/:nom_de_bid', auth.basic, (req, res, next) => {
const nomDeBid = decodeURI(req.params.nom_de_bid);
User.findOne({ nomDeBid }, (err, user) => {
@@ -69,7 +69,7 @@ module.exports = function (server, auth) {
});
});
server.post('/signup/verify/resend', (req, res, next) => {
server.post('/signup/verify/resend', auth.basic, (req, res, next) => {
const { body: { email = null } = {} } = req;
User.resendVerificationEmail(email, (err, user, info) => {