mirror of https://github.com/zulip/zulip.git
devlogin: Fix handling of fragments in the URL.
When a fragment (i.e. section starting with `#`) is present in the URL
when landing the development login page, dev-login.js used to append
it to the appends it to the `formaction` attribute of all the input
tag present in the `dev_login.html`.
This made sense before 139cb8026f
, which
adjusted the structure of how `next` was passed.
To fix this, we adjust the JavaScript login to set the `next` hidden
input instead.
fixes #16215
This commit is contained in:
parent
2befc007cf
commit
737d796e1c
|
@ -5,12 +5,12 @@ $(() => {
|
|||
// dev_login.html is rendered.
|
||||
if ($("[data-page-id='dev-login']").length > 0) {
|
||||
if (window.location.hash.substring(0, 1) === "#") {
|
||||
/* We append the location.hash to the formaction so that URL can be
|
||||
/* We append the location.hash to the input field with name next so that URL can be
|
||||
preserved after user is logged in. See this:
|
||||
https://stackoverflow.com/questions/5283395/url-hash-is-persisting-between-redirects */
|
||||
$("input[name='direct_email']").each(function () {
|
||||
const new_formaction = $(this).attr("formaction") + "/" + window.location.hash;
|
||||
$(this).attr("formaction", new_formaction);
|
||||
$("input[name='next']").each(function () {
|
||||
const new_value = $(this).attr("value") + window.location.hash;
|
||||
$(this).attr("value", new_value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue