Ruby 固定装置密码列错误
我正在尝试为我的测试加载一个具有密码列(二进制数据类型)的装置。我正在使用的工具使用 EzCrypto gem 在存储/检索密码之前对其进行加密和解密。现在,如果我的列是二进制的,我认为 Rails 会自动将密码存储为加密的 - 但我得到的只是:
1.
Error:
test_is_working(FirstTest):
RuntimeError: Failed to decode the field. Incorrect key?
/Library/Ruby/Gems/1.8/gems/mislav-will_paginate 2.3.11/lib/will_paginate/finder.rb:170:in 'method_missing'
unit/first_test.rb:8:in setup
2.
Error:
test_sanity(FirstTest):
RuntimeError: Failed to decode the field. Incorrect key?
unit/first_test.rb:8:in `setup'
Fixture file looks like this:
first_hussle:
type: FirstAccount
user: jsewq
username: [email protected]
password: 'abc123'
有任何线索吗?
I am trying to load a fixture for my tests which has a password column (binary datatype). The tool i am using uses EzCrypto gem for encrypting and decrypting passwords before they are stored/retrieved. Now if my column is binary i thought rails would automatically store the password as encrypted - but all i get is:
1.
Error:
test_is_working(FirstTest):
RuntimeError: Failed to decode the field. Incorrect key?
/Library/Ruby/Gems/1.8/gems/mislav-will_paginate 2.3.11/lib/will_paginate/finder.rb:170:in 'method_missing'
unit/first_test.rb:8:in setup
2.
Error:
test_sanity(FirstTest):
RuntimeError: Failed to decode the field. Incorrect key?
unit/first_test.rb:8:in `setup'
Fixture file looks like this:
first_hussle:
type: FirstAccount
user: jsewq
username: [email protected]
password: 'abc123'
any clues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 ezcrypto 来加密您的设备中的密码。假设您的固定装置用于用户表,并且您已经定义了
user_crypto_provider.rb
文件/类。You need to use ezcrypto to encrypt the password in your fixture. Assuming that your fixture is for the users table and that you've got a
user_crypto_provider.rb
file / class defined.