Sha256: ccde8b65b6672c511eac65ae6b86d0664d848f2c8f239f4c41df5d5387de5348

Contents?: true

Size: 806 Bytes

Versions: 6

Compression:

Stored size: 806 Bytes

Contents

module DeviseTokenAuth::Concerns::ConfirmableSupport
  extend ActiveSupport::Concern

  included do
    # Override standard devise `postpone_email_change?` method
    # for not to use `will_save_change_to_email?` & `email_changed?` methods.
    def postpone_email_change?
      postpone = self.class.reconfirmable &&
        email_value_in_database != email &&
        !@bypass_confirmation_postpone &&
        self.email.present? &&
        (!@skip_reconfirmation_in_callback || !email_value_in_database.nil?)
      @bypass_confirmation_postpone = false
      postpone
    end
  end

  protected

  def email_value_in_database
    rails51 = Rails.gem_version >= Gem::Version.new("5.1.x")
    if rails51 && respond_to?(:email_in_database)
      email_in_database
    else
      email_was
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
devise_token_auth-1.2.4 app/models/devise_token_auth/concerns/confirmable_support.rb
devise_token_auth-1.2.2 app/models/devise_token_auth/concerns/confirmable_support.rb
devise_token_auth-1.2.1 app/models/devise_token_auth/concerns/confirmable_support.rb
devise_token_auth-1.2.0 app/models/devise_token_auth/concerns/confirmable_support.rb
devise_token_auth-1.1.5 app/models/devise_token_auth/concerns/confirmable_support.rb
sidecar_token_auth-1.0.1 app/models/devise_token_auth/concerns/confirmable_support.rb