Ruby on rails Rails 4.1.0和authlogic bcrypt问题
我正在用rvm ruby 2.1.0运行最新的OSX。在Ruby on rails Rails 4.1.0和authlogic bcrypt问题,ruby-on-rails,ruby,authlogic,bcrypt,Ruby On Rails,Ruby,Authlogic,Bcrypt,我正在用rvm ruby 2.1.0运行最新的OSX。在捆绑更新到Rails 4.1.0和authlogic 3.4.1之后,当我启动服务器时,我收到以下错误: authlogic/crypto_providers/bcrypt.rb:1:in `require': cannot load such file -- bcrypt (LoadError) authlogic-3.4.1/lib/authlogic/crypto_providers/bcrypt.rb:1:in `<top
捆绑更新到Rails 4.1.0和authlogic 3.4.1之后,当我启动服务器时,我收到以下错误:
authlogic/crypto_providers/bcrypt.rb:1:in `require': cannot load such file -- bcrypt (LoadError)
authlogic-3.4.1/lib/authlogic/crypto_providers/bcrypt.rb:1:in `<top (required)>'
authlogic-3.4.1/lib/authlogic.rb:60:in `require'
authlogic-3.4.1/lib/authlogic.rb:60:in `block in <top (required)>'
authlogic-3.4.1/lib/authlogic.rb:59:in `each'
authlogic-3.4.1/lib/authlogic.rb:59:in `<top (required)>'
bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
bundler-1.5.2/lib/bundler.rb:131:in `require'
application.rb:7:in `<top (required)>'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:79:in `require'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:79:in `block in server'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
authlogic/crypto\u providers/bcrypt.rb:1:在'require'中:无法加载这样的文件--bcrypt(LoadError)
authlogic-3.4.1/lib/authlogic/crypto_providers/bcrypt.rb:1:in`'
authlogic-3.4.1/lib/authlogic.rb:60:in'require'
authlogic-3.4.1/lib/authlogic.rb:60:in'block in'
authlogic-3.4.1/lib/authlogic.rb:59:在'each'中
authlogic-3.4.1/lib/authlogic.rb:59:in`'
bundler-1.5.2/lib/bundler/runtime.rb:76:in'require'
bundler-1.5.2/lib/bundler/runtime.rb:76:in`require中的block(2个级别)'
bundler-1.5.2/lib/bundler/runtime.rb:72:in'each'
bundler-1.5.2/lib/bundler/runtime.rb:72:in'block in require'
bundler-1.5.2/lib/bundler/runtime.rb:61:in'each'
bundler-1.5.2/lib/bundler/runtime.rb:61:in'require'
bundler-1.5.2/lib/bundler.rb:131:in'require'
application.rb:7:in`'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:79:in'require'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:79:in'block in server'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in'tap'
railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in'server'
railties-4.1.0/lib/rails/commands/commands\u tasks.rb:40:in'run\u command!'
railties-4.1.0/lib/rails/commands.rb:17:in`'
在authlogic github帐户上使用此选项
Authlogic已将其默认加密系统从SHA512更改为SCrypt
看来你需要把这个放在你的档案里
gem 'authlogic', '~> 3.4.0'
gem 'scrypt'
如果你不想要SCrypt,你可以使用Sha512
acts_as_authentic do |c|
c.crypto_provider = Authlogic::CryptoProviders::Sha512
end
在您的User.rb中
您可能还需要指定authlogic gem的版本
gem 'authlogic', github: 'binarylogic/authlogic', ref: 'e4b2990d6282f3f7b50249b4f639631aef68b939'
但是我想这个问题很快就会解决你能告诉我User.rb中的Authlogic::CryptoProviders::Sha512
做了什么吗?如果我不添加它会发生什么?你应该尝试删除它。Authlogic默认使用SCrypt,但没有将其作为依赖项。因此,您必须在GEM文件中包含scrypt。如果不想切换到sCrypt,请使用行c.crypto\u provider=Authlogic::CryptoProviders::Sha512
。阅读本文了解更多信息,谢谢。我的问题是,我不明白加密系统在这个gem中做什么。如果我使用一种加密方式运行应用程序两周,然后切换到另一种加密方式,那么最后两周的新用户将无法再次登录?密码在存储到数据库之前会被加密。这样,密码是安全的,只有用户知道它。您可以使用中的帮助程序转换到新的加密系统,或者继续使用旧的加密系统,使用c.crypto\u provider=Authlogic::CryptoProviders::Sha512
好的,谢谢,我想我描述的情况可能会发生