irlnathan / activityoverlord20

This is an update to activityOverlord.
158 stars 52 forks source link

Email validation fails... Is this a waterline issue? #13

Open armellarcier opened 9 years ago

armellarcier commented 9 years ago

Sign-up seems broken. Any email address gets rejected by validator.

err:  Error (E_VALIDATION) :: 1 attribute is invalid
at WLValidationError.WLError (/Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:26:15)
at new WLValidationError (/Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/lib/waterline/error/WLValidationError.js:20:28)
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:46:43
at allValidationsChecked (/Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:210:5)
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:49:16
at done (/Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:239:19)
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:40:16
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:191:23
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:49:16
at done (/Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:239:19)
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:40:16
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:164:64
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:162:20
at /Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:230:13
at _arrayEach (/Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:81:9)
at _each (/Users/armellarcier/Code/activityoverlord20/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:72:13)

Invalid attributes sent to User:
 • email
   • "email" validation rule failed for input: 'guy@example.com'

err.invalidAttributes:  { email: 
   [ { rule: 'email',
   message: '"email" validation rule failed for input: \'guy@example.com\'' } ] }

Checked with multiple e-mails. Works if I remove validation constraint (email: true) in model attribute obj.

marmite22 commented 9 years ago

In api\models\User.js I changed type: 'string' to type: 'email' and removed email: true from attributes.email. Like this

email: {
    type: 'email',
    unique: true,
    required: true
},
tylernotfound commented 9 years ago

Was having the same issue after Heroku automatically rolled an update from v0.11.0 to v0.11.2. This worked for me. Thanks @marmite22!

The dropping of {email: true} support should probably be mentioned somewhere. (If it already was, I apologize, I missed it.)

alsosweet commented 9 years ago

@marmite22 it work for me. but how can i find this change in http://sailsjs.org or somewhere