Sha256: 3d48a8966af2f2c20c6950abb05c967ef467f3be44041a1cfa3c8e29834a73d3

Contents?: true

Size: 530 Bytes

Versions: 4

Compression:

Stored size: 530 Bytes

Contents

module Clearance
  module PasswordStrategies
    module BCrypt
      require 'bcrypt'

      extend ActiveSupport::Concern

      def authenticated?(password)
        ::BCrypt::Password.new(encrypted_password) == password
      end

      def password=(new_password)
        @password = new_password

        if new_password.present?
          self.encrypted_password = encrypt(new_password)
        end
      end

      private

      def encrypt(password)
        ::BCrypt::Password.create(password)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
clearance-1.0.0.rc4 lib/clearance/password_strategies/bcrypt.rb
clearance-1.0.0.rc3 lib/clearance/password_strategies/bcrypt.rb
clearance-1.0.0.rc2 lib/clearance/password_strategies/bcrypt.rb
clearance-1.0.0.rc1 lib/clearance/password_strategies/bcrypt.rb