MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / _validateEmail

Method _validateEmail

pkg/ttnpb/user.pb.validate.go:583–601  ·  view source on GitHub ↗
(addr string)

Source from the content-addressed store, hash-verified

581}
582
583func (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.

Callers 1

ValidateFieldsMethod · 0.95

Calls 2

_validateHostnameMethod · 0.95
NewMethod · 0.65

Tested by

no test coverage detected