Sha256: 6f13ebc9738fcf183dbb796a57ebd136c50cb51f04daa1a3053dccf538f7764f
Contents?: true
Size: 814 Bytes
Versions: 2
Compression:
Stored size: 814 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) end def password_confirmation=(password) super SimpleAuth::Config.crypter.call(password, password_salt) 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.2 | lib/simple_auth/compat/active_record.rb |
simple_auth-2.0.1 | lib/simple_auth/compat/active_record.rb |