FIX: Account creation regression (#24169)

Regressed in 351cbab1a8
This commit is contained in:
Jarek Radosz 2023-10-31 02:05:35 +01:00 committed by GitHub
parent 08deedfd6e
commit 360289e108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 10 deletions

View File

@ -373,16 +373,15 @@ export default class CreateAccount extends Component.extend(
);
}
const attrs = this.getProperties(
"model.accountName",
"model.accountEmail",
"accountPassword",
"model.accountUsername",
"accountChallenge",
"inviteCode"
);
attrs["accountPasswordConfirm"] = this.accountHoneypot;
const attrs = {
accountName: this.model.accountName,
accountEmail: this.model.accountEmail,
accountPassword: this.accountPassword,
accountUsername: this.model.accountUsername,
accountChallenge: this.accountChallenge,
inviteCode: this.inviteCode,
accountPasswordConfirm: this.accountHoneypot,
};
const userFields = this.userFields;
const destinationUrl = this.get("model.authOptions.destination_url");

View File

@ -2,6 +2,10 @@ import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import sinon from "sinon";
import LoginMethod from "discourse/models/login-method";
import pretender, {
parsePostData,
response,
} from "discourse/tests/helpers/create-pretender";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
@ -32,10 +36,22 @@ acceptance("Create Account", function () {
.dom("#username-validation.good")
.exists("the username validation is good");
pretender.post("/u", (request) => {
assert.step("request");
const data = parsePostData(request.requestBody);
assert.strictEqual(data.name, "Dr. Good Tuna");
assert.strictEqual(data.password, "cool password bro");
assert.strictEqual(data.email, "good.tuna@test.com");
assert.strictEqual(data.username, "good-tuna");
return response({ success: true });
});
await click(".modal-footer .btn-primary");
assert
.dom(".modal-footer .btn-primary:disabled")
.exists("create account is disabled");
assert.verifySteps(["request"]);
});
test("validate username", async function (assert) {