From 7185965d97a2d7d98f5feda6cc10fb5d87fcf816 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 14 Jul 2026 01:32:30 +0200 Subject: Store return_to before resetting session in loging. Fixes returning to an admin page before logging in --- app/controllers/application_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app/controllers/application_controller.rb') 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 { locale: I18n.locale == I18n.default_locale ? nil : I18n.locale } end - def safe_return_to(url) - return events_path if url.blank? + def safe_return_to(url, default: events_path) + return default if url.blank? uri = URI.parse(url) - return events_path if uri.host.present? - return events_path unless url.start_with?('/') + return default if uri.host.present? + return default unless url.start_with?('/') url rescue URI::InvalidURIError - events_path + default end end -- cgit v1.3