Sha256: 3fdd7e9b514ee8c082cf31c7a03681ab8abb13cde63bd98c70dce6c70050bd9a
Contents?: true
Size: 816 Bytes
Versions: 1
Compression:
Stored size: 816 Bytes
Contents
# frozen_string_literal: true module DeviseTokenAuth::Concerns::UserOmniauthCallbacks extend ActiveSupport::Concern included do validates :email, presence: true,if: :email_provider? validates :email, :devise_token_auth_email => true, allow_nil: true, allow_blank: true, if: :email_provider? validates_presence_of :uid, unless: :email_provider? # only validate unique emails among email registration users validates :email, uniqueness: { case_sensitive: false, scope: [ :provider ] + DeviseTokenAuth.multitenancy_scope_fields }, on: :create, if: :email_provider? # keep uid in sync with email before_save :sync_uid before_create :sync_uid end protected def email_provider? provider == 'email' end def sync_uid self.uid = email if email_provider? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise_token_auth_multitenancy-1.1.3.1 | app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb |