Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#8190] Fix logout issues #8195

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading