Sha256: 7f1eda54e2ff3b35adc706cc9d6983a59142dd83ee8d31ebab55a3c75e9e0309

Contents?: true

Size: 636 Bytes

Versions: 6

Compression:

Stored size: 636 Bytes

Contents

# frozen-string-literal: true

module Rodauth
  Feature.define(:update_password_hash, :UpdatePasswordHash) do
    depends :login_password_requirements_base

    def password_match?(password)
      if (result = super) && update_password_hash?
        @update_password_hash = false
        set_password(password)
      end

      result
    end

    private

    def update_password_hash?
      password_hash_cost != @current_password_hash_cost || @update_password_hash
    end

    def get_password_hash
      if hash = super
        @current_password_hash_cost = extract_password_hash_cost(hash)
      end

      hash
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rodauth-2.38.0 lib/rodauth/features/update_password_hash.rb
rodauth-2.37.0 lib/rodauth/features/update_password_hash.rb
rodauth-2.36.0 lib/rodauth/features/update_password_hash.rb
rodauth-2.34.0 lib/rodauth/features/update_password_hash.rb
rodauth-2.33.0 lib/rodauth/features/update_password_hash.rb
rodauth-2.32.0 lib/rodauth/features/update_password_hash.rb