현재 일반 비밀번호 (...)를 저장하는 Rails 앱을 만들고 있습니다. 그래서 '표준'SHA512 암호화로 Authlogic 인증으로 마이그레이션 할 것입니다.안전한 비밀번호 저장에서 authlogic으로 이전
내가 어떤 작품을 잘 그했다 :
#file /models/user.rb
class User < ActiveRecord::Base
acts_as_authentic { |c|
c.transition_from_crypto_providers = [MyOwnNoCrypto, Authlogic::CryptoProviders::Sha512]
}
end
#file /lib/my_own_no_crypto.rb
class MyOwnNoCrypto
def self.encrypt(*tokens)
return tokens[0] # or tokens.join I guess
end
def self.matches?(crypted_password, *tokens)
return crypted_password == tokens.join
end
end
그것은 좋은 - 그리고 잘 작동합니다 -하지만 아마도 Authlogic 코어 옵션, 그렇게 할 수있는 섹시 방법이 있는지 궁금해?
감사합니다.
와우! 슈퍼 좋은! 고마워. –