- 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

@@ -1,3 +1,5 @@
const errors = require('restify-errors');
const validateJsonData = (req, res, next) => {
if (!req.is('application/json')) {
return next(

View File

@@ -15,7 +15,7 @@ const PhoneSchema = new mongoose.Schema(
label: {
type: String,
required: true,
enum: [ 'home', 'mobile' ],
enum: [ 'home', 'mobile', 'work' ],
},
},

View File

@@ -7,5 +7,6 @@ module.exports = function(server, auth) {
require('./items.js')(server, auth);
require('./reset.js')(server, auth);
require('./sales.js')(server, auth);
require('./signup.js')(server, auth);
require('./users.js')(server, auth);
};

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) => {