diff --git a/app/api/auth/[...all]/route.ts b/app/api/auth/[...all]/route.ts index cd52ec5..1531024 100644 --- a/app/api/auth/[...all]/route.ts +++ b/app/api/auth/[...all]/route.ts @@ -16,7 +16,7 @@ async function mutate(request: Request) { const password = input && typeof input === "object" && "password" in input ? input.password : undefined; const newPassword = input && typeof input === "object" && "newPassword" in input ? input.newPassword : undefined; const value = password ?? newPassword; - if (typeof value !== "string" || value.length < 12 || value.length > 128) { + if (typeof value !== "string" || value.length < 6 || value.length > 128) { throw new HttpError(400, "invalid-password-length"); } } diff --git a/components/auth/account-form.tsx b/components/auth/account-form.tsx index d585112..e1cf0c6 100644 --- a/components/auth/account-form.tsx +++ b/components/auth/account-form.tsx @@ -61,7 +61,7 @@ export function AccountForm({ mode, siteKey, nextPath }: {
{register && ชื่อ} อีเมล - รหัสผ่าน + รหัสผ่าน {captcha &&
} diff --git a/lib/auth/server.test.ts b/lib/auth/server.test.ts index 038cc14..f7d2e3d 100644 --- a/lib/auth/server.test.ts +++ b/lib/auth/server.test.ts @@ -47,10 +47,10 @@ describe("actual administrator session boundary", () => { mocks.session.mockResolvedValue(null); await expect(requireAdmin()).rejects.toMatchObject({ status: 401 }); }); - it("defaults accounts to user and requires strong new passwords", async () => { + it("defaults accounts to user and requires six-character new passwords", async () => { (await import("./server")).getAuth(); const options = mocks.auth.mock.calls.at(-1)![0]; - expect(options.emailAndPassword).toMatchObject({ disableSignUp: false, minPasswordLength: 12 }); + expect(options.emailAndPassword).toMatchObject({ disableSignUp: false, minPasswordLength: 6 }); expect(options.plugins).toContainEqual({ defaultRole: "user" }); expect(options.rateLimit.customStorage.consume).toBeTypeOf("function"); expect(options.databaseHooks).toBeUndefined(); diff --git a/lib/auth/server.ts b/lib/auth/server.ts index 1bf7005..a459eed 100644 --- a/lib/auth/server.ts +++ b/lib/auth/server.ts @@ -53,7 +53,7 @@ function createAuth() { emailAndPassword: { enabled: true, disableSignUp: false, - minPasswordLength: 12, + minPasswordLength: 6, maxPasswordLength: 128, }, advanced: {