Don't redirect to POST request URLs after sign out

Sometimes we define URLs for POST requests which are not defined for GET
requests, such as "/residence", so redirecting to it after signing out
results in a routing error.

So instead of using the request referer, we're using the stored location
devise uses, and we're not storing locations in POST requests.
This commit is contained in:
Javi Martín
2020-08-11 18:19:48 +02:00
parent 2fa8792a35
commit 83e4633643
3 changed files with 22 additions and 2 deletions

View File

@@ -107,7 +107,7 @@ class ApplicationController < ActionController::Base
end
def set_return_url
if !devise_controller? && is_navigational_format?
if request.get? && !devise_controller? && is_navigational_format?
store_location_for(:user, request.fullpath)
end
end