【问题标题】:ActiveAdmin logging out automatically after password change更改密码后 ActiveAdmin 自动注销
【发布时间】:2019-04-05 18:33:00
【问题描述】:

标题说明了一切,基本上我面对的是same problem as here,但我使用的是ActiveAdmin,我无法解决这个问题。

我已经尝试添加:

controller do
    def update
      if current_account.update_with_password(params[:account])
        sign_in(current_account, :bypass => true)
        flash[:notice] = 'Password updated.'
        redirect_to account_path
      else
        render :action => :show
      end
    end
end

在 ActiveAdmin 注册页面,但没有工作。

我发现的其他解决方案是在设计配置文件中设置config.sign_in_after_reset_password = true,但我在初始化程序中看不到任何devise.rb 文件。我还在admin_user.rb模型文件中绑定了self.sign_in_after_reset_password = true,但是没有用。

【问题讨论】:

  • 只是为了确认一下,您正在使用 Devise 并且在 config/initializers 中没有 devise.rb 初始化程序?

标签: ruby-on-rails devise ruby-on-rails-5 activeadmin


【解决方案1】:

我认为您的设计配置位于config 目录中。如果不满意,请在initializers/devise.rb 中添加以下行。


Devise.setup do |config|
  config.sign_in_after_reset_password = true
end

【讨论】:

    【解决方案2】:

    你只需要运行命令

    rails db:seed

    这将更新你的 seed.rb 文件

    【讨论】:

      猜你喜欢
      • 2016-05-17
      • 2021-01-28
      • 2015-08-29
      • 1970-01-01
      • 1970-01-01
      • 2019-02-07
      • 1970-01-01
      • 1970-01-01
      • 2021-12-03
      相关资源
      最近更新 更多