Skip to content

Commit

Permalink
Merge branch '8190-fix-logout-issues' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Apr 9, 2024
2 parents 722c51e + 9e78dd7 commit 44a7e4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class PermissionDenied < StandardError
class RouteNotFound < StandardError
end

before_action :set_gettext_locale, :redirect_gettext_locale
before_action :collect_locales
before_action :set_gettext_locale, :store_gettext_locale
before_action :redirect_gettext_locale, :collect_locales

protect_from_forgery if: :authenticated?, with: :exception
skip_before_action :verify_authenticity_token, unless: :authenticated?
Expand Down Expand Up @@ -76,18 +76,20 @@ def set_gettext_locale
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE']
end

locale = AlaveteliLocalization.set_session_locale(
AlaveteliLocalization.set_session_locale(
params_locale, session[:locale], cookies[:locale], browser_locale,
AlaveteliLocalization.default_locale
)

# set response header informing the browser what language the page is in
response.headers['Content-Language'] = I18n.locale.to_s
end

def store_gettext_locale
# set the current stored locale to the requested_locale
current_session_locale = session[:locale]
if current_session_locale != locale
session[:locale] = locale
if current_session_locale != AlaveteliLocalization.locale
session[:locale] = AlaveteliLocalization.locale

# we need to set something other than StripEmptySessions::STRIPPABLE_KEYS
# otherwise the cookie will be striped from the response
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AttachmentsController < ApplicationController
include InfoRequestHelper
include PublicTokenable

skip_before_action :html_response
skip_before_action :html_response, :store_gettext_locale

before_action :find_info_request, :find_incoming_message, :find_attachment
before_action :find_project
Expand Down

0 comments on commit 44a7e4e

Please sign in to comment.