DEV: Remove jquery from create-account modal (#27710)

This commit is contained in:
David Taylor 2024-07-04 12:11:25 +01:00 committed by GitHub
parent 2900cbefe1
commit 32c8bcc3af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,6 @@ import { alias, notEmpty } from "@ember/object/computed";
import { service } from "@ember/service"; import { service } from "@ember/service";
import { isEmpty } from "@ember/utils"; import { isEmpty } from "@ember/utils";
import { observes } from "@ember-decorators/object"; import { observes } from "@ember-decorators/object";
import $ from "jquery";
import { Promise } from "rsvp"; import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { setting } from "discourse/lib/computed"; import { setting } from "discourse/lib/computed";
@ -388,17 +387,16 @@ export default class CreateAccount extends Component.extend(
this._challengeExpiry = 1; this._challengeExpiry = 1;
// Trigger the browser's password manager using the hidden static login form: // Trigger the browser's password manager using the hidden static login form:
const $hidden_login_form = $("#hidden-login-form"); const hiddenLoginForm = document.querySelector("#hidden-login-form");
$hidden_login_form if (hiddenLoginForm) {
.find("input[name=username]") hiddenLoginForm.querySelector("input[name=username]").value =
.val(attrs.accountUsername); attrs.accountUsername;
$hidden_login_form hiddenLoginForm.querySelector("input[name=password]").value =
.find("input[name=password]") attrs.accountPassword;
.val(attrs.accountPassword); hiddenLoginForm.querySelector("input[name=redirect]").value =
$hidden_login_form userPath("account-created");
.find("input[name=redirect]") hiddenLoginForm.submit();
.val(userPath("account-created")); }
$hidden_login_form.submit();
return new Promise(() => {}); // This will never resolve, the page will reload instead return new Promise(() => {}); // This will never resolve, the page will reload instead
} else { } else {
this.set("flash", result.message || I18n.t("create_account.failed")); this.set("flash", result.message || I18n.t("create_account.failed"));