Sha256: 6c82f8807c994925f53814ae063a50c01d5ba93a0e46eb840f48aced0ef01374

Contents?: true

Size: 751 Bytes

Versions: 6

Compression:

Stored size: 751 Bytes

Contents

module DeviseJwtAuth::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
    if Devise.rails51? && respond_to?(:email_in_database)
      email_in_database
    else
      email_was
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
devise_jwt_auth-0.1.5 app/models/devise_jwt_auth/concerns/confirmable_support.rb
devise_jwt_auth-0.1.4 app/models/devise_jwt_auth/concerns/confirmable_support.rb
devise_jwt_auth-0.1.3 app/models/devise_jwt_auth/concerns/confirmable_support.rb
devise_jwt_auth-0.1.2 app/models/devise_jwt_auth/concerns/confirmable_support.rb
devise_jwt_auth-0.1.1 app/models/devise_jwt_auth/concerns/confirmable_support.rb
devise_jwt_auth-0.1.0 app/models/devise_jwt_auth/concerns/confirmable_support.rb