F
F
First name Last name2015-11-12 18:38:45
Node.js
First name Last name, 2015-11-12 18:38:45

SailsJs: email form validator not passing valid email, why?

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

When entering a normal email address, an error is displayed
{
  "error": "E_VALIDATION",
  "status": 400,
  "summary": "1 attribute is invalid",
  "model": "User",
  "invalidAttributes": {
    "userEmail": [
      {
        "rule": "email",
        "message": "\"email\" validation rule failed for input: '[email protected]'"
      }
    ]
  }
}

Why is that? What criteria are set for email address validation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill, 2015-11-13
@kirill89

I'm not very familiar with this engine, but try

{ email: { type: 'email', required: true, unique: true } }

Judging by the documentation it is more correct variant.
PS: I found the answer on github .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question