Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isEmail validator does not work (as described in documentation) #3770

Closed
vladh opened this issue May 20, 2015 · 4 comments
Closed

isEmail validator does not work (as described in documentation) #3770

vladh opened this issue May 20, 2015 · 4 comments

Comments

@vladh
Copy link

vladh commented May 20, 2015

The documentation states that this should work:

validate: {
  isEmail: true
}

However, this yields:

{
  __raw: [TypeError: Cannot assign to read only property 'allow_display_name' of true],
  message: 'Cannot assign to read only property \'allow_display_name\' of true',
  path: 'email',
  type: 'Validation error',
  value: [TypeError: Cannot assign to read only property 'allow_display_name' of true]
},

The correct value validator.js expects is:

validate: {
  isEmail: {}
}
@BridgeAR
Copy link
Contributor

What version do you use? This should have been fixed

@vladh
Copy link
Author

vladh commented May 21, 2015

I'm on 3.0.1. I do have that code — maybe I'm doing something dumb. Here's what I'm trying:

    email: {
      type: DataTypes.STRING
      allowNull: false
      validate: {
        isEmail: {args: true, msg: 'phy-simpleUser-email-invalid'}
      }
    }

@BridgeAR
Copy link
Contributor

It should work if you remove args: true.

@vladh
Copy link
Author

vladh commented May 21, 2015

So it does! I was under the impression that that was required.

mickhansen added a commit that referenced this issue May 28, 2015
Fix two minor issues. Closes #3812 and #3770
IrfanBaqui pushed a commit to IrfanBaqui/sequelize that referenced this issue Jun 24, 2015
IrfanBaqui pushed a commit to IrfanBaqui/sequelize that referenced this issue Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants