FIX: use the destination_url cookie as return_path if present (#23594)

This commit is contained in:
Renato Atilio 2023-09-15 12:11:03 -03:00 committed by GitHub
parent 8823b5e504
commit aa9510a731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
import cookie from "discourse/lib/cookie";
import DiscourseURL, { userPath } from "discourse/lib/url";
import Category from "discourse/models/category";
import Composer from "discourse/models/composer";
@ -230,7 +231,9 @@ const ApplicationRoute = DiscourseRoute.extend({
handleShowLogin() {
if (this.siteSettings.enable_discourse_connect) {
const returnPath = encodeURIComponent(window.location.pathname);
const returnPath = cookie("destination_url")
? getURL("/")
: encodeURIComponent(window.location.pathname);
window.location = getURL("/session/sso?return_path=" + returnPath);
} else {
this.modal.show(LoginModal, {