【问题标题】:I've been using Authlogic, but now need to remove all traces of it. What do I need to do?我一直在使用 Authlogic,但现在需要删除它的所有痕迹。我需要做什么?
【发布时间】:2010-10-29 09:43:34
【问题描述】:

所以我打算从 Authlogic 切换到 Devise。由于我只有几个测试帐户,我认为最好简单地删除所有 Authlogic 内容和我的用户表,然后设置 Devise。我正在使用 Rails 3。除了从我的 gemfile 中删除 authlogic、删除用户和 user_session 模型/表之外,我还需要做什么吗?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 devise authlogic


    【解决方案1】:

    哟,

    当对所有模块使用设计时,您的用户表应如下所示:

     id                   | integer                     | not null default nextval('contributors_id_seq'::regclass)
     email                | character varying(255)      | not null default ''::character varying
     encrypted_password   | character varying(128)      | not null default ''::character varying
     password_salt        | character varying(255)      | not null default ''::character varying
     confirmation_token   | character varying(255)      | 
     confirmed_at         | timestamp without time zone | 
     confirmation_sent_at | timestamp without time zone | 
     reset_password_token | character varying(255)      | 
     remember_token       | character varying(255)      | 
     remember_created_at  | timestamp without time zone | 
     sign_in_count        | integer                     | default 0
     current_sign_in_at   | timestamp without time zone | 
     last_sign_in_at      | timestamp without time zone | 
     current_sign_in_ip   | character varying(255)      | 
     last_sign_in_ip      | character varying(255)      | 
     failed_attempts      | integer                     | default 0
     unlock_token         | character varying(255)      | 
     locked_at            | timestamp without time zone | 
     created_at           | timestamp without time zone | 
     updated_at           | timestamp without time zone | 
    

    您必须编写迁移来添加/重命名列。

    很棒的是,您可以将默认加密器更改为 Authlogic 使用的加密器,这样您就可以顺利迁移所有现有用户...

    见: http://github.com/plataformatec/devise/blob/master/lib/devise/encryptors/authlogic_sha512.rb

    您可以在设计初始化程序中更改加密器:

    config.encryptor = :authlogic_sha512
    

    应该就是这样了:)。

    【讨论】:

      【解决方案2】:

      是的,我已经这样做了,并注意您不需要删除/删除 users 表(显然,您在生产中不太可能这样做!),只需使用迁移来添加上述内容字段。根据需要更改加密器,它应该相当流畅。确保 password_salt 和 encrypted_pa​​ssword 字段命名正确或使用迁移重命名它们(或者可能可以将它们映射到某个地方,但我没有找到它)。

      【讨论】:

        猜你喜欢
        • 2013-07-22
        • 2013-07-05
        • 1970-01-01
        • 1970-01-01
        • 2018-01-07
        • 1970-01-01
        • 2019-06-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多