FIX: don't redirect incorrectly after full screen login (#7170)

Fixes two issues:
1. Redirecting to an external origin's path after login did not work
2. User would be erroneously redirected to the external origin after logout

https://meta.discourse.org/t/109755
This commit is contained in:
Leo McArdle
2019-03-19 12:39:13 +00:00
committed by David Taylor
parent 6fb49e74a1
commit b084750953
4 changed files with 66 additions and 4 deletions

View File

@ -57,17 +57,18 @@ class Users::OmniauthCallbacksController < ApplicationController
rescue URI::Error
end
if parsed
@origin = "#{parsed.path}?#{parsed.query}"
if parsed && (parsed.host == nil || parsed.host == Discourse.current_hostname)
@origin = "#{parsed.path}"
@origin << "?#{parsed.query}" if parsed.query
end
end
if @origin.blank?
@origin = Discourse.base_uri("/")
else
@auth_result.destination_url = origin
end
@auth_result.destination_url = origin
if @auth_result.failed?
flash[:error] = @auth_result.failed_reason.html_safe
return render('failure')