如何防止使用设计确认和设置密码后自动登录

How to prevent automatic signin after confirmation and setting password using devise

我需要使用电子邮件创建用户,然后在确认后向电子邮件发送确认 link,他将被重定向到密码编辑页面,他将在其中设置密码。当我们更改密码并提交时,用户会自动登录,我想阻止它。谁能告诉我怎么做

我正在使用最新的设计 rails 和 ruby 版本,我已经解决了各种堆栈溢出问题,但仍然找不到解决方案

改变你的config/initializers/devise.rb

你会看到...

  # When set to false, does not sign a user in automatically after their password is
  # reset. Defaults to true, so a user is signed in automatically after a reset.
  # config.sign_in_after_reset_password = true

取消注释并将最后一行更改为

  config.sign_in_after_reset_password = false