From c01c16ecdb3849ecc6bb94135d8c8d1d8763f5b9 Mon Sep 17 00:00:00 2001 From: kidhab <32387157+kidhab@users.noreply.github.com> Date: Thu, 30 Mar 2023 10:05:47 +0200 Subject: [PATCH] Specify an URL to redirect after logout via settings (#989) --- app/controllers/sessions_controller.rb | 6 +++++- config/app_config.yml.SAMPLE | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 5b3d0780..f3c50e2a 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -21,7 +21,11 @@ class SessionsController < ApplicationController def destroy logout - redirect_to login_url, :notice => I18n.t('sessions.logged_out') + if FoodsoftConfig[:logout_redirect_url].present? + redirect_to FoodsoftConfig[:logout_redirect_url] + else + redirect_to login_url, :notice => I18n.t('sessions.logged_out') + end end # redirect to root, going to default foodcoop when none given diff --git a/config/app_config.yml.SAMPLE b/config/app_config.yml.SAMPLE index e43705b6..d6f0f8f9 100644 --- a/config/app_config.yml.SAMPLE +++ b/config/app_config.yml.SAMPLE @@ -32,6 +32,9 @@ default: &defaults # custom foodsoft software URL (used in footer) #foodsoft_url: https://github.com/foodcoops/foodsoft + # URL to redirect to after logging out + # logout_redirect_url: https://foodcoop.test + # Default language #default_locale: en # By default, foodsoft takes the language from the webbrowser/operating system.