Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Account creation regression #24169

Merged
merged 1 commit into from Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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");
Expand Down
Expand Up @@ -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";

Expand Down Expand Up @@ -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) {
Expand Down