繁体   English   中英

Ruby on Rails Devise - 身份验证后重定向到 POST 请求

[英]Ruby on Rails Devise - Redirecting to POST request after authentication

Devise 具有重定向功能,允许用户返回到登录前所在的页面。

问题是它只适用于 GET。 如果用户在 POST 期间停止进行身份验证(例如填写表格),他将相应地重定向,但使用 GET。

有什么方法可以更改此设置以便正确完成 POST?

非常感谢。

repost gem 的帮助下,您可以重定向到 POST 操作。

在这里查看完整的解决方案: Devise redirect after sign_in and perfom POST action

确保您在C:\\ Ruby192 \\ lib \\ ruby​​ \\ gems \\ 1.9.1 \\ gems \\ devise-1.1.5 \\ app \\ views \\ devise \\ shared中具有_links.erb文件(路径可能有所不同),其内容如下。

<%- if controller_name != 'sessions' %>
  <%= link_to "Sign in", new_session_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
  <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
  <%= link_to "Didn't receive confirmation instructions?",   new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) &&  controller_name != 'unlocks' %>
  <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>    <br />
<% end -%>

希望你得到解决方案。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM