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

Do not validate CSRF token in API unless needed

Closes #35705

See merge request !13256
This commit is contained in:
Sean McGivern 2017-08-03 10:47:03 +00:00
commit 1018ab0516
2 changed files with 3 additions and 1 deletions

View file

@ -48,8 +48,8 @@ module API
end
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 }
rescue_from Gitlab::Access::AccessDeniedError do

View file

@ -16,6 +16,8 @@ module API
@current_user = initial_current_user
Gitlab::I18n.locale = @current_user&.preferred_language
sudo!
@current_user