密码更改后,ActiveAdmin自动注销

问题描述 投票:0回答:1

标题说明了一切,基本上我面对的是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文件。我还在self.sign_in_after_reset_password = true模型文件中绑了admin_user.rb,但没有用。

ruby-on-rails devise ruby-on-rails-5 activeadmin
1个回答
1
投票

我认为你的设计配置是在config目录中的某个地方。如果你没有罚款,请在initializers/devise.rb中添加以下行。


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

© www.soinside.com 2019 - 2024. All rights reserved.