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

Comments

4 participants
@vladh

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: {}
}

@mickhansen mickhansen added the bug label May 20, 2015

@BridgeAR

This comment has been minimized.

Contributor

BridgeAR commented May 20, 2015

What version do you use? This should have been fixed

@vladh

This comment has been minimized.

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

This comment has been minimized.

Contributor

BridgeAR commented May 21, 2015

It should work if you remove args: true.

@vladh

This comment has been minimized.

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

Merge pull request #3817 from BridgeAR/master
Fix two minor issues. Closes #3812 and #3770

@janmeier janmeier closed this May 28, 2015

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