diff --git a/src/gui/src/UI/UIWindowSessionList.js b/src/gui/src/UI/UIWindowSessionList.js index e00becf27..7157320d8 100644 --- a/src/gui/src/UI/UIWindowSessionList.js +++ b/src/gui/src/UI/UIWindowSessionList.js @@ -97,6 +97,13 @@ async function UIWindowSessionList (options) { }, }); $(el_window).find('.login-c2a-session-list').on('click', async function (e) { + // The login window is a centered cover and this picker would + // otherwise float on top of it, hiding its username field. Only + // the reload flows close it: in the no-reload (popup) flows the + // picker doubles as the fallback UI when the login window is + // abandoned, and the resolve() below still needs a live promise + // chain either way. + if ( options.reload_on_success ) $(el_window).close(); const login = await UIWindowLogin({ referrer: options.referrer, reload_on_success: options.reload_on_success, @@ -120,7 +127,11 @@ async function UIWindowSessionList (options) { } }); $(el_window).find('.signup-c2a-session-list').on('click', async function (e) { - $('.signup-c2a-clickable').parents('.window').close(); + // Same picker-over-cover overlap as the login c2a above, same + // reload-flows-only close. (The selector this replaces — + // '.signup-c2a-clickable', the LOGIN window's c2a class — + // matched nothing in this window and closed nothing.) + if ( options.reload_on_success ) $(el_window).close(); // create Signup window const signup = await UIWindowSignup({ referrer: options.referrer, diff --git a/src/gui/src/UI/UIWindowSignup.js b/src/gui/src/UI/UIWindowSignup.js index 1ed4d5a73..97feb7143 100644 --- a/src/gui/src/UI/UIWindowSignup.js +++ b/src/gui/src/UI/UIWindowSignup.js @@ -574,7 +574,29 @@ function UIWindowSignup(options) { if (options.reload_on_success) { window.onbeforeunload = null; - const redirectUrl = options.redirect_url || '/'; + // Signup can interrupt a direct app landing (the + // login cover page's "Sign up", the session + // picker's "Create Account", the + // must_login_or_signup fallback) — landing on '/' + // afterwards would silently drop the app the URL + // asked for, so app landings are preserved and + // the reloaded boot replays them, launch and + // dashboard intro included (the query string is + // deliberately left behind, mirroring login's + // credential-leak hygiene). Every other route + // keeps the historical '/' — notably + // /action/signup, where coming back to the same + // path would just show this window again. + const on_app_landing = + /^\/(?:desktop\/)?app\/[^/]+\/?$/.test( + window.location.pathname, + ); + const redirectUrl = + options.redirect_url || + (on_app_landing + ? window.location.origin + + window.location.pathname + : '/'); window.location.replace(redirectUrl); } else { resolve(email_verified);