Sha256: 3fe22a466f3a8ae2b90eac95fd3f691604a2a38afa1f61535b0f32b47c03684d
Contents?: true
Size: 718 Bytes
Versions: 2
Compression:
Stored size: 718 Bytes
Contents
module SimpleAuth def self.migrate_passwords! require "ostruct" generator = OpenStruct.new.extend(ActiveModel::SecurePassword::InstanceMethodsOnActivation) Config.model_class.find_each do |record| generator.password = record.password_hash Config.model_class .where(id: record.id) .update_all(password_digest: generator.password_digest) end end module ActiveRecord module InstanceMethods def password=(password) super SimpleAuth::Config.crypter.call(password, password_salt) @password = password end def authenticate(password) super SimpleAuth::Config.crypter.call(password, password_salt) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_auth-2.0.4 | lib/simple_auth/compat/active_record.rb |
simple_auth-2.0.3 | lib/simple_auth/compat/active_record.rb |