Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function v2Response(
mailer_notifications_mfa_factor_enrolled_enabled: false,
mailer_notifications_mfa_factor_unenrolled_enabled: false,
external_phone_enabled: false,
sms_autoconfirm: false,
sms_autoconfirm: true,
sms_max_frequency: 5,
sms_otp_exp: 60,
sms_otp_length: 6,
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/config/push/push.encoders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ export const PUSH_AUTH_LEAF_MAP: ReadonlyArray<PushAuthLeafSpec> = [
{
configPath: ["auth", "sms", "enable_confirmations"],
apiKey: "sms_autoconfirm",
transform: asBoolean,
transform: invert,
},
{ configPath: ["auth", "sms", "template"], apiKey: "sms_template", transform: asString },
{ configPath: ["auth", "sms", "otp_length"], apiKey: "sms_otp_length", transform: asNumber },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,13 @@ describe("encodeAuthBody", () => {
expect(result.body).toEqual({ mailer_autoconfirm: false });
});

it("inverts sms.enable_confirmations into sms_autoconfirm", () => {
const result = encodeAuthBody(
authInput({ changes: [change(["auth", "sms", "enable_confirmations"], true)] }),
);
expect(result.body).toEqual({ sms_autoconfirm: false });
});

it("maps password_requirements through the character-class table", () => {
const result = encodeAuthBody(
authInput({ changes: [change(["auth", "password_requirements"], "letters_digits")] }),
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/tests/helpers/config-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function v2ProjectConfigResponse(
sms_messagebird_originator: null,
sms_textlocal_sender: null,
sms_vonage_from: null,
sms_autoconfirm: false,
sms_autoconfirm: true,
sms_max_frequency: 5,
sms_otp_exp: 60,
sms_otp_length: 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,9 @@ describe("fromApiProjectConfig — auth section", () => {
expect(result.auth?.email?.enable_confirmations).toBe(false);
});

test("sms_autoconfirm maps to auth.sms.enable_confirmations WITHOUT inverting", () => {
// Unlike mailer_autoconfirm/email.enable_confirmations, this key isn't inverted.
test("sms_autoconfirm inverts to auth.sms.enable_confirmations", () => {
const result = fromApiProjectConfig({ auth: { sms_autoconfirm: true } });
expect(result.auth?.sms?.enable_confirmations).toBe(true);
expect(result.auth?.sms?.enable_confirmations).toBe(false);
});

test("rate_limit_otp renames to auth.rate_limit.sign_in_sign_ups", () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/project-config/registry-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,7 @@ const web3Rows: ReadonlyArray<ProjectConfigMappingRow> = [

const smsBaseRows: ReadonlyArray<ProjectConfigMappingRow> = [
boolRow(["auth", "sms", "enable_signup"], "external_phone_enabled"),
// Not inverted, unlike mailer_autoconfirm: sms_autoconfirm maps to enable_confirmations directly.
boolRow(["auth", "sms", "enable_confirmations"], "sms_autoconfirm"),
invertedBoolRow(["auth", "sms", "enable_confirmations"], "sms_autoconfirm"),
Comment thread
7ttp marked this conversation as resolved.
Resolved
stringRow(["auth", "sms", "template"], "sms_template"),
secondsDurationRow(["auth", "sms", "max_frequency"], "sms_max_frequency"),
uintRow(["auth", "sms", "otp_length"], "sms_otp_length"),
Expand Down
Loading