It doesn't make sense to redirect when not logged in on a non-GET

request. We should report a failure then. They likely logged out or
in another tab or timed out.
This commit is contained in:
Robin Ward
2014-03-05 11:48:06 -05:00
parent 2a99f1b15e
commit b0f3061113
3 changed files with 15 additions and 2 deletions

View File

@ -86,7 +86,13 @@ class ApplicationController < ActionController::Base
rescue_from Discourse::NotLoggedIn do |e|
raise e if Rails.env.test?
redirect_to "/"
if request.get?
redirect_to "/"
else
render status: 403, json: failed_json.merge(message: I18n.t(:not_logged_in))
end
end
rescue_from Discourse::NotFound do