From 06a7f1af0541876817f12febb82024a2d66ea6cf Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Thu, 1 Sep 2022 17:08:55 +0300 Subject: [PATCH] replaced MX email validator with email format only --- core/settings.go | 2 +- forms/admin_password_reset_request.go | 2 +- forms/admin_upsert.go | 2 +- forms/test_email_send.go | 2 +- forms/user_email_change_request.go | 2 +- forms/user_password_reset_request.go | 2 +- forms/user_upsert.go | 2 +- forms/user_verification_request.go | 2 +- forms/validators/record_data.go | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/settings.go b/core/settings.go index db4e989dc..4a592855a 100644 --- a/core/settings.go +++ b/core/settings.go @@ -301,7 +301,7 @@ func (c MetaConfig) Validate() error { validation.Field(&c.AppName, validation.Required, validation.Length(1, 255)), validation.Field(&c.AppUrl, validation.Required, is.URL), validation.Field(&c.SenderName, validation.Required, validation.Length(1, 255)), - validation.Field(&c.SenderAddress, is.Email, validation.Required), + validation.Field(&c.SenderAddress, is.EmailFormat, validation.Required), validation.Field(&c.VerificationTemplate, validation.Required), validation.Field(&c.ResetPasswordTemplate, validation.Required), validation.Field(&c.ConfirmEmailChangeTemplate, validation.Required), diff --git a/forms/admin_password_reset_request.go b/forms/admin_password_reset_request.go index 663e38b2b..546113fde 100644 --- a/forms/admin_password_reset_request.go +++ b/forms/admin_password_reset_request.go @@ -65,7 +65,7 @@ func (form *AdminPasswordResetRequest) Validate() error { &form.Email, validation.Required, validation.Length(1, 255), - is.Email, + is.EmailFormat, ), ) } diff --git a/forms/admin_upsert.go b/forms/admin_upsert.go index ddde01bb0..f2916d435 100644 --- a/forms/admin_upsert.go +++ b/forms/admin_upsert.go @@ -86,7 +86,7 @@ func (form *AdminUpsert) Validate() error { &form.Email, validation.Required, validation.Length(1, 255), - is.Email, + is.EmailFormat, validation.By(form.checkUniqueEmail), ), validation.Field( diff --git a/forms/test_email_send.go b/forms/test_email_send.go index d1e426e67..61c211751 100644 --- a/forms/test_email_send.go +++ b/forms/test_email_send.go @@ -34,7 +34,7 @@ func (form *TestEmailSend) Validate() error { &form.Email, validation.Required, validation.Length(1, 255), - is.Email, + is.EmailFormat, ), validation.Field( &form.Template, diff --git a/forms/user_email_change_request.go b/forms/user_email_change_request.go index f85caa8de..488239920 100644 --- a/forms/user_email_change_request.go +++ b/forms/user_email_change_request.go @@ -62,7 +62,7 @@ func (form *UserEmailChangeRequest) Validate() error { &form.NewEmail, validation.Required, validation.Length(1, 255), - is.Email, + is.EmailFormat, validation.By(form.checkUniqueEmail), ), ) diff --git a/forms/user_password_reset_request.go b/forms/user_password_reset_request.go index 56ea90402..b5c6e4915 100644 --- a/forms/user_password_reset_request.go +++ b/forms/user_password_reset_request.go @@ -66,7 +66,7 @@ func (form *UserPasswordResetRequest) Validate() error { &form.Email, validation.Required, validation.Length(1, 255), - is.Email, + is.EmailFormat, ), ) } diff --git a/forms/user_upsert.go b/forms/user_upsert.go index 895807237..f6bf5c483 100644 --- a/forms/user_upsert.go +++ b/forms/user_upsert.go @@ -83,7 +83,7 @@ func (form *UserUpsert) Validate() error { &form.Email, validation.Required, validation.Length(1, 255), - is.Email, + is.EmailFormat, validation.By(form.checkEmailDomain), validation.By(form.checkUniqueEmail), ), diff --git a/forms/user_verification_request.go b/forms/user_verification_request.go index 047f494bb..76a3aaa95 100644 --- a/forms/user_verification_request.go +++ b/forms/user_verification_request.go @@ -66,7 +66,7 @@ func (form *UserVerificationRequest) Validate() error { &form.Email, validation.Required, validation.Length(1, 255), - is.Email, + is.EmailFormat, ), ) } diff --git a/forms/validators/record_data.go b/forms/validators/record_data.go index 49ba67c6f..a5f09f95c 100644 --- a/forms/validators/record_data.go +++ b/forms/validators/record_data.go @@ -189,7 +189,7 @@ func (validator *RecordDataValidator) checkEmailValue(field *schema.SchemaField, return nil // nothing to check } - if is.Email.Validate(val) != nil { + if is.EmailFormat.Validate(val) != nil { return validation.NewError("validation_invalid_email", "Must be a valid email") }