簡體   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