sailsjs: model email validation seems not to work -


on fresh sailsjs installation, i've got test model defined this:

module.exports = {   attributes: {     username:{       type:'string'     }     ,email:{       type:'string'       ,email:true     }   } }; 

and if navigate this:

http://localhost:1337/user/create?username=stratboy1&email=test@wow.com 

i error:

{   "error": "e_validation",   "status": 400,   "summary": "1 attribute invalid",   "model": "user",   "invalidattributes": {     "email": [       {         "rule": "email",         "message": "\"email\" validation rule failed input: 'test@wow.com'"       }     ]   } } 

any of knows why?

i've come across earlier don't quite remember cause.

as quick fix, can substitute

email: { type: 'string', email: true } 

with

email: { type: 'email' } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -