简体   繁体   English

用户请求新的确认后如何重定向到设计登录页面

[英]How to redirect to the Devise login page after user requests new confirmation

How would I redirect to the login page after the user has requested a new confirmation email to be received?在用户请求接收新的确认电子邮件,我将如何重定向到登录页面?

This is not the case where the user logs in for the first time after confirmation like discussed on Stack Overflow.这是不是哪里像堆栈溢出讨论确认后的第一次用户登录的情况。 This is about a non-confirmed, not logged-in user requesting a new confirmation email because they did not receive it.这是关于一个未确认的、未登录的用户请求新的确认电子邮件,因为他们没有收到它。

  • User goes to /users/confirmations/new .用户转到/users/confirmations/new
  • submits form.提交表格。
  • The same form gets shown again.再次显示相同的表单。

Instead I want it to go to the login_path after submit.相反,我希望它在提交后转到login_path

I overruled the confirmations controller, but how do I hook into Devise and make it redirect to login_path ?我否决了确认控制器,但是如何连接到 Devise 并使其重定向到login_path

class Users::ConfirmationsController < Devise::RegistrationsController

  layout :resolve_layout


  def new
    self.resource = resource_class.new
    redirect_to login_path
  end

end

You set this path with the following code inside your confirmations_controller :您可以设置您的内部下面的代码此路径confirmations_controller

def after_resending_confirmation_instructions_path_for
    login_path # or whatever you want
end

However, the default is to redirect to new_session_path(resource_name) which does exactly what you want and so it does for my app.但是,默认设置是重定向到new_session_path(resource_name) ,它完全符合您的要求,对我的应用程序也是如此。

Maybe it depends on the version of Devise.也许这取决于设计的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 devise 令牌验证中确认 email 后重定向到登录页面/或使用户登录成功 - How to redirect to login page/ or making user login successful after confirm email in devise token auth 确认后如何使设计重定向 - How to make Devise redirect after confirmation 使用devise在Rails 3中发送密码重置说明后,如何将用户重定向到登录页面 - How to redirect the user to login page after sending password reset instructions in rails 3 using devise Rails 和 Devise:成功登录后如何将用户重定向回请求的页面? - Rails and Devise: How to redirect user back to the requested Page after successful login? 通过devise注册后如何将用户重定向回登录表单? - How to redirect user back to login form after signing up with devise? Rails / Devise登录后如何重定向到特定页面 - Rails/Devise How to redirect to a specific page after login 使用Devise登录后重定向到上一页 - Redirect to previous page after login with Devise 成功进入DEVISE后,如何将用户重定向回以前需要登录的操作? - After a successful DEVISE login, how to redirect user back to previous action that required login? 发送确认后如何登录用户? - How to login user after sending confirmation? Devise:登录后如何重定向到上一页,但前提是前一页需要身份验证? - Devise: How to redirect to the previous page after login, but only if previous page requires authentication?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM