【发布时间】:2010-06-26 19:47:04
【问题描述】:
我正在尝试将我的 rails 应用程序中的自定义简单身份验证系统转换为使用 AuthLogic。我已经设法让一切工作变得相当容易,但是现在当我尝试登录时,它不会正确验证我的凭据。相关代码如下:
# app/models/profile.rb
class Profile < ActiveRecord::Base
acts_as_authentic do |c|
c.transition_from_crypto_providers = Authlogic::CryptoProviders::Sha1,
c.crypto_provider = Authlogic::CryptoProviders::Sha512
end
end
我曾经在创建时使用它来散列我的密码:
# app/models/profile.rb
def hash_password
self.salt = ActiveSupport::SecureRandom.base64(8)
self.hashed_password = Digest:SHA1.hexdigest(self.salt + @password)
end
我已经将所有必要的表列转换为与 AuthLogic 兼容。 有没有办法记录 AuthLogic 将密码散列为什么?还有什么问题?
【问题讨论】:
标签: ruby-on-rails authentication authlogic