Commit 1018ab05 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'dm-api-current-user' into 'master'

Do not validate CSRF token in API unless needed

Closes #35705

See merge request !13256
parents f105a857 14644d40
...@@ -48,8 +48,8 @@ module API ...@@ -48,8 +48,8 @@ module API
end end
before { header['X-Frame-Options'] = 'SAMEORIGIN' } before { header['X-Frame-Options'] = 'SAMEORIGIN' }
before { Gitlab::I18n.locale = current_user&.preferred_language }
# The locale is set to the current user's locale when `current_user` is loaded
after { Gitlab::I18n.use_default_locale } after { Gitlab::I18n.use_default_locale }
rescue_from Gitlab::Access::AccessDeniedError do rescue_from Gitlab::Access::AccessDeniedError do
......
...@@ -16,6 +16,8 @@ module API ...@@ -16,6 +16,8 @@ module API
@current_user = initial_current_user @current_user = initial_current_user
Gitlab::I18n.locale = @current_user&.preferred_language
sudo! sudo!
@current_user @current_user
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment