(addr string)
| 581 | } |
| 582 | |
| 583 | func (m *User) _validateEmail(addr string) error { |
| 584 | a, err := mail.ParseAddress(addr) |
| 585 | if err != nil { |
| 586 | return err |
| 587 | } |
| 588 | addr = a.Address |
| 589 | |
| 590 | if len(addr) > 254 { |
| 591 | return errors.New("email addresses cannot exceed 254 characters") |
| 592 | } |
| 593 | |
| 594 | parts := strings.SplitN(addr, "@", 2) |
| 595 | |
| 596 | if len(parts[0]) > 64 { |
| 597 | return errors.New("email address local phrase cannot exceed 64 characters") |
| 598 | } |
| 599 | |
| 600 | return m._validateHostname(parts[1]) |
| 601 | } |
| 602 | |
| 603 | // UserValidationError is the validation error returned by User.ValidateFields |
| 604 | // if the designated constraints aren't met. |
no test coverage detected