summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-14 01:32:30 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-14 01:32:30 +0200
commit7185965d97a2d7d98f5feda6cc10fb5d87fcf816 (patch)
tree0605a4b72c55224c4545d9ce8cfbdb101c619495 /app/controllers/application_controller.rb
parenta18a170f791769691fe905cfe76d103b7a345e87 (diff)
Store return_to before resetting session in loging. Fixes returning to an admin page before logging in
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index cbeb40d..d8de975 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -21,13 +21,13 @@ class ApplicationController < ActionController::Base
21 { locale: I18n.locale == I18n.default_locale ? nil : I18n.locale } 21 { locale: I18n.locale == I18n.default_locale ? nil : I18n.locale }
22 end 22 end
23 23
24 def safe_return_to(url) 24 def safe_return_to(url, default: events_path)
25 return events_path if url.blank? 25 return default if url.blank?
26 uri = URI.parse(url) 26 uri = URI.parse(url)
27 return events_path if uri.host.present? 27 return default if uri.host.present?
28 return events_path unless url.start_with?('/') 28 return default unless url.start_with?('/')
29 url 29 url
30 rescue URI::InvalidURIError 30 rescue URI::InvalidURIError
31 events_path 31 default
32 end 32 end
33end 33end