闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
526 B

  1. # frozen_string_literal: true
  2. class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
  3. skip_before_action :authenticate_resource_owner!
  4. before_action :set_locale
  5. before_action :store_current_location
  6. before_action :authenticate_resource_owner!
  7. private
  8. def store_current_location
  9. store_location_for(:user, request.url)
  10. end
  11. def set_locale
  12. I18n.locale = current_user.try(:locale) || I18n.default_locale
  13. rescue I18n::InvalidLocale
  14. I18n.locale = I18n.default_locale
  15. end
  16. end