Skip to content

Commit 0727ac7

Browse files
ihatov08MaicolBen
authored andcommitted
Delete namespece and fix file name change to prevent override behavior of the default email validator (#1242)
1 parent 3419201 commit 0727ac7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module DeviseTokenAuth::Concerns::UserOmniauthCallbacks
55

66
included do
77
validates :email, presence: true,if: :email_provider?
8-
validates :email, 'devise_token_auth/email' => true, allow_nil: true, allow_blank: true, if: :email_provider?
8+
validates :email, :devise_token_auth_email => true, allow_nil: true, allow_blank: true, if: :email_provider?
99
validates_presence_of :uid, unless: :email_provider?
1010

1111
# only validate unique emails among email registration users

app/validators/devise_token_auth/email_validator.rb renamed to app/validators/devise_token_auth_email_validator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
class DeviseTokenAuth::EmailValidator < ActiveModel::EachValidator
3+
class DeviseTokenAuthEmailValidator < ActiveModel::EachValidator
44
def validate_each(record, attribute, value)
55
unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
66
record.errors[attribute] << email_invalid_message

0 commit comments

Comments
 (0)