Ruby 固定装置密码列错误

发布于 2024-09-03 19:50:58 字数 884 浏览 3 评论 0原文

我正在尝试为我的测试加载一个具有密码列(二进制数据类型)的装置。我正在使用的工具使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南冥有猫 2024-09-10 19:50:58

您需要使用 ezcrypto 来加密您的设备中的密码。假设您的固定装置用于用户表,并且您已经定义了 user_crypto_provider.rb 文件/类。

password: <%= UserCryptoProvider.encrypt('abc123') %>

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.

password: <%= UserCryptoProvider.encrypt('abc123') %>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文