Skip to content

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

Closed

Description

@vladh

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

Activity

  1. added
    type: bug
    on May 20, 2015
  2. BridgeAR commented on May 20, 2015

    @BridgeAR
    Contributor

    What version do you use? This should have been fixed

  3. vladh commented on May 21, 2015

    @vladh
    Author

    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'}
          }
        }
  4. BridgeAR commented on May 21, 2015

    @BridgeAR
    Contributor

    It should work if you remove args: true.

  5. vladh commented on May 21, 2015

    @vladh
    Author

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

  6. added a commit that references this issue on May 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions