Sha256: 38db99aceeb20c38788be611d897856f0f2287fb8ccd39e33243de4c680baad2

Contents?: true

Size: 1.02 KB

Versions: 14

Compression:

Stored size: 1.02 KB

Contents

require File.expand_path("spec_helper", File.dirname(__FILE__))

describe 'Rodauth update_password feature' do
  [false, true].each do |ph|
    it "should support updating passwords for accounts #{'with account_password_hash_column' if ph} if hash cost changes" do
      cost = BCrypt::Engine::MIN_COST
      rodauth do
        enable :login, :logout, :update_password_hash
        account_password_hash_column :ph if ph
        password_hash_cost{cost}
      end
      roda do |r|
        r.rodauth
        next unless session[:account_id]
        rodauth.account_from_session
        r.root{rodauth.send(:get_password_hash)}
      end

      login
      content = page.html

      logout
      login
      page.current_path.must_equal '/'
      content.must_equal page.html

      cost += 1
      logout
      login
      new_content = page.html
      page.current_path.must_equal '/'
      content.wont_equal new_content

      logout
      login
      page.current_path.must_equal '/'
      new_content.must_equal page.html
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rodauth-1.17.0 spec/update_password_hash_spec.rb
rodauth-1.16.0 spec/update_password_hash_spec.rb
rodauth-1.15.0 spec/update_password_hash_spec.rb
rodauth-1.14.0 spec/update_password_hash_spec.rb
rodauth-1.13.0 spec/update_password_hash_spec.rb
rodauth-1.12.0 spec/update_password_hash_spec.rb
rodauth-1.11.0 spec/update_password_hash_spec.rb
rodauth-1.10.0 spec/update_password_hash_spec.rb
rodauth-1.9.0 spec/update_password_hash_spec.rb
rodauth-1.8.0 spec/update_password_hash_spec.rb
rodauth-1.7.0 spec/update_password_hash_spec.rb
rodauth-1.6.0 spec/update_password_hash_spec.rb
rodauth-1.5.0 spec/update_password_hash_spec.rb
rodauth-1.4.0 spec/update_password_hash_spec.rb