fixed signup error

This commit is contained in:
David Baldwynn 2016-08-17 12:04:42 -07:00
parent b4923dda4c
commit de5ac881c9
16 changed files with 161 additions and 124 deletions

5
.gitignore vendored
View file

@ -78,3 +78,8 @@ build/
coverage/ coverage/
coverageServer/ coverageServer/
coverageClient/ coverageClient/
# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

View file

@ -1,16 +1,74 @@
# DOCKER-VERSION 1.7.0 # Build:
# docker build -t meanjs/mean .
#
# Run:
# docker run -it meanjs/mean
#
# Compose:
# docker-compose up -d
FROM node:4 FROM ubuntu:latest
MAINTAINER David Baldwynn <team@tellform.com>
WORKDIR /usr/src/app WORKDIR ~/Documents/tellform
# Install Mean.JS Prerequisites # Install Utilities
RUN npm install -g grunt-cli bower RUN apt-get update -q
RUN apt-get install -yqq python wget aptitude htop vim git traceroute dnsutils curl ssh sudo tree tcpdump nano psmisc gcc make build-essential libfreetype6 libfontconfig libkrb5-dev
# currently only works for development ENV python /usr/bin/python
# Install gem sass for grunt-contrib-sass
RUN apt-get install -y ruby
RUN gem install sass
# Install NodeJS
RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
RUN sudo apt-get install -yq nodejs
# Install MEAN.JS Prerequisites
RUN npm install --quiet -g grunt-cli gulp bower mocha karma-cli pm2
RUN mkdir /opt/mean.js
RUN mkdir -p /opt/mean.js/public/lib
WORKDIR /opt/mean.js
# Copies the local package.json file to the container
# and utilities docker container cache to not needing to rebuild
# and install node_modules/ everytime we build the docker, but only
# when the local package.json file changes.
# Install npm packages
ADD package.json /opt/mean.js/package.json
RUN npm install --quiet
# Install bower packages
ADD bower.json /opt/mean.js/bower.json
ADD .bowerrc /opt/mean.js/.bowerrc
RUN bower install --quiet --allow-root --config.interactive=false
# Share local directory on the docker container
ADD . /opt/mean.js
# Machine cleanup
RUN npm cache clean
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set development environment as default
ENV NODE_ENV development ENV NODE_ENV development
# Port 3000 for server # Ports generic
EXPOSE 80:80
EXPOSE 443:443
# Port 3000 for MEAN.JS server
EXPOSE 3000:3000
# Port 5858 for node debug
EXPOSE 5858:5858
# Port 35729 for livereload # Port 35729 for livereload
EXPOSE 3000 35729 EXPOSE 35729:35729
CMD ["grunt"]
# Run MEAN.JS server
CMD ["npm", "start"]

View file

@ -99,6 +99,7 @@ exports.resendVerificationEmail = function(req, res, next){
* Signup * Signup
*/ */
exports.signup = function(req, res) { exports.signup = function(req, res) {
// For security measures we remove the roles from the req.body object // For security measures we remove the roles from the req.body object
delete req.body.roles; delete req.body.roles;
@ -109,15 +110,15 @@ exports.signup = function(req, res) {
user.provider = 'local'; user.provider = 'local';
// Then save the temporary user // Then save the temporary user
nev.createTempUser(user, function (err, newTempUser) { nev.createTempUser(user, function (err, existingPersistentUser, newTempUser) {
debugger;
if (err) { if (err) {
console.log('Error: '); console.log('Error: ');
console.log(err); console.log(err);
return res.status(400).send({ return res.status(400).send({
message: errorHandler.getErrorMessage(err) message: errorHandler.getErrorMessage(err)
}); });
} else { }
// new user created // new user created
if (newTempUser) { if (newTempUser) {
@ -137,7 +138,6 @@ exports.signup = function(req, res) {
console.log('Error: User already exists!'); console.log('Error: User already exists!');
return res.status(400).send({message: 'Error: User already exists!'}); return res.status(400).send({message: 'Error: User already exists!'});
} }
}
}); });
}; };

View file

@ -127,6 +127,7 @@ function BaseFieldSchema(){
'hidden', 'hidden',
'yes_no', 'yes_no',
'natural', 'natural',
'stripe',
'number' 'number'
] ]
}, },

View file

@ -12,8 +12,6 @@ var should = require('should'),
config = require('../../config/config'), config = require('../../config/config'),
FormSubmission = mongoose.model('FormSubmission'); FormSubmission = mongoose.model('FormSubmission');
var exampleDemo = { var exampleDemo = {
activeCount: 1, activeCount: 1,
DOB: '', DOB: '',

View file

@ -19,10 +19,10 @@
"angular-ui-router": "~0.2.11", "angular-ui-router": "~0.2.11",
"ng-file-upload": "^12.0.4", "ng-file-upload": "^12.0.4",
"angular-raven": "~0.5.11", "angular-raven": "~0.5.11",
"angular-ui-date": "~0.0.8", "angular-ui-date": "~0.0.11",
"lodash": "~3.10.0", "lodash": "~3.10.0",
"angular-ui-sortable": "~0.13.4", "angular-ui-sortable": "~0.13.4",
"angular-permission": "~1.1.0", "angular-permission": "~1.1.1",
"file-saver.js": "~1.20150507.2", "file-saver.js": "~1.20150507.2",
"angular-bootstrap-colorpicker": "~3.0.19", "angular-bootstrap-colorpicker": "~3.0.19",
"angular-ui-router-tabs": "~1.7.0", "angular-ui-router-tabs": "~1.7.0",
@ -34,9 +34,9 @@
"raven-js": "^3.0.4", "raven-js": "^3.0.4",
"tableExport.jquery.plugin": "^1.5.1", "tableExport.jquery.plugin": "^1.5.1",
"js-yaml": "^3.6.1", "js-yaml": "^3.6.1",
"angular-ui-select": "whitef0x0/ui-select#compiled", "angular-ui-select": "https://github.com/whitef0x0/ui-select.git#compiled",
"angular-translate": "~2.11.0", "angular-translate": "~2.11.0",
"ng-device-detector": "^3.0.1", "ng-device-detector": "~3.0.1",
"ng-translate": "*" "ng-translate": "*"
}, },
"resolutions": { "resolutions": {

View file

@ -121,7 +121,6 @@ module.exports = function(db) {
next(); next();
}); });
}); });
//Setup Prerender.io //Setup Prerender.io

View file

@ -1,29 +1,24 @@
version: '2'
services:
db:
image: mongo:3.2
ports:
- "27017:27017"
volumes:
- mongo-data-wt:/data/db
redis:
image: redis
web: web:
restart: always
build: . build: .
volumes: container_name: tellform
- .:/usr/src/app command: npm start
command: node server.js
ports:
- "3000:3000"
- "35729:35729"
links: links:
- db - db
- redis ports:
- "3000:3000"
- "5858:5858"
- "35729:35729"
environment: environment:
DB_HOST: db - NODE_ENV=development
REDIS_HOST: redis
volumes: volumes:
mongo-data-wt: - ./:/opt/mean.js
driver: local - /opt/mean.js/node_modules
- /opt/mean.js/public
- /opt/mean.js/uploads
db:
image: mongo:3.2
container_name: db_1
restart: always
ports:
- "27017:27017"

View file

@ -30,6 +30,7 @@
"bower": "~1.6.5", "bower": "~1.6.5",
"chalk": "^1.1.3", "chalk": "^1.1.3",
"compression": "~1.6.0", "compression": "~1.6.0",
"connect": "^3.4.1",
"connect-flash": "~0.1.1", "connect-flash": "~0.1.1",
"connect-mongo": "~0.8.2", "connect-mongo": "~0.8.2",
"consolidate": "~0.13.1", "consolidate": "~0.13.1",
@ -71,6 +72,7 @@
"multer": "~1.1.0", "multer": "~1.1.0",
"node-freegeoip": "0.0.1", "node-freegeoip": "0.0.1",
"nodemailer": "~1.10.0", "nodemailer": "~1.10.0",
"nodemailer-sparkpost-transport": "^1.0.0",
"passport": "~0.3.0", "passport": "~0.3.0",
"passport-anonymous": "^1.0.1", "passport-anonymous": "^1.0.1",
"passport-facebook": "~2.0.0", "passport-facebook": "~2.0.0",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,27 +0,0 @@
<div class="field row dropdown" ng-click="setActiveField(field._id, index, true)" ng-if="field.fieldOptions.length > 0">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3>
<span class="fa fa-angle-double-right"></span>
{{field.title}}
<span class="required-error" ng-show="!field.required">{{ 'OPTIONAL' | translate }}</span>
</h3>
</div>
<div class="col-xs-12 field-input ">
<ui-select ng-model="field.fieldValue"
theme="selectize"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-focus="setActiveField(field._id, index, true)">
<ui-select-match placeholder="Type or select an option">
{{$select.selected.option_value}}
</ui-select-match>
<ui-select-choices
repeat="option in field.fieldOptions | filter: $select.search"
ng-class="{'active': option.option_value === field.fieldValue }">
<span ng-bind-html="option.option_value | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
</div>
</div>
<br>

View file

@ -16,7 +16,7 @@ angular.module('users').config(['$translateProvider', function ($translateProvid
EMAIL_LABEL: 'Email', EMAIL_LABEL: 'Email',
SIGNUP_HEADER_TEXT: 'Sign up with your email', SIGNUP_HEADER_TEXT: 'Sign up with your email',
SIGNIN_HEADER_TEXT: 'Signup in with your email', SIGNIN_HEADER_TEXT: 'Sign in with your email or username',
SIGNUP_ERROR_TEXT: 'Couldn\'t complete registration due to errors', SIGNUP_ERROR_TEXT: 'Couldn\'t complete registration due to errors',

View file

@ -165,6 +165,11 @@ var questions = [
name: 'email', name: 'email',
message: 'What should be the email for your admin account?' message: 'What should be the email for your admin account?'
}, },
{
type: 'input',
name: 'username',
message: 'What should be the username for your admin account?'
},
{ {
type: 'password', type: 'password',
name: 'password', name: 'password',
@ -175,7 +180,7 @@ var questions = [
if(!fs.existsSync('./\.env')) { if(!fs.existsSync('./\.env')) {
console.log(chalk.green('\n\nHi, welcome to TellForm Setup')); console.log(chalk.green('\n\nHi, welcome to TellForm Setup'));
console.log(chalk.green('You should only run this the first time you setup TellForm\n--------------------------------------------------\n\n')); console.log(chalk.green('You should only run this the first time you run TellForm\n--------------------------------------------------\n\n'));
inquirer.prompt([questions[0]]).then(function (confirmAns) { inquirer.prompt([questions[0]]).then(function (confirmAns) {
if (confirmAns['shouldContinue']) { if (confirmAns['shouldContinue']) {
@ -185,6 +190,7 @@ if(!fs.existsSync('./\.env')) {
answers['SIGNUP_DISABLED'] = false ? answers['SIGNUP_DISABLED'] === false : true; answers['SIGNUP_DISABLED'] = false ? answers['SIGNUP_DISABLED'] === false : true;
var email = answers['email']; var email = answers['email'];
var username = answers['email'];
var pass = answers['password']; var pass = answers['password'];
delete answers['email']; delete answers['email'];
delete answers['password']; delete answers['password'];
@ -198,7 +204,7 @@ if(!fs.existsSync('./\.env')) {
firstName: 'Admin', firstName: 'Admin',
lastName: 'Account', lastName: 'Account',
email: email, email: email,
username: email, username: username,
password: pass, password: pass,
provider: 'local', provider: 'local',
roles: ['admin', 'user'] roles: ['admin', 'user']