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