Skip to content

A platform for community discussion. Free, open, simple.

FIX: Improve signup destination URL handling (#34221)

Régis Hanol4480c9cbf11f
diff --git a/app/assets/javascripts/discourse/app/controllers/signup.js b/app/assets/javascripts/discourse/app/controllers/signup.js
index 5891cc8d82e..cc4fc25b68a 100644
--- a/app/assets/javascripts/discourse/app/controllers/signup.js
+++ b/app/assets/javascripts/discourse/app/controllers/signup.js
@@ -479,10 +479,10 @@ export default class SignupPageController extends Controller {
set("username", this.accountUsername);
set("password", this.accountPassword);
- const destinationUrl = cookie("destination_url");
- if (destinationUrl) {
- removeCookie("destination_url");
- set("redirect", destinationUrl);
+ let { destination_url } = this.authOptions || {};
+
+ if (destination_url && destination_url !== "/signup") {
+ set("redirect", destination_url);
} else {
set("redirect", userPath("account-created"));
}