fix : 12 to 6 for password

This commit is contained in:
2026-10-02 12:15:37 +07:00 Unverified
parent 96c27f8fc3
commit 724234a6f9
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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");
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ export function AccountForm({ mode, siteKey, nextPath }: {
<CardContent className="flex flex-col gap-4"><form onSubmit={submit}><FieldGroup>
{register && <Field><FieldLabel htmlFor="name">ชื่อ</FieldLabel><Input id="name" name="name" required maxLength={100} /></Field>}
<Field><FieldLabel htmlFor="email">อีเมล</FieldLabel><Input id="email" name="email" type="email" required autoComplete="email" /></Field>
<Field><FieldLabel htmlFor="password">รหัสผ่าน</FieldLabel><Input id="password" name="password" type="password" required minLength={12} autoComplete={register ? "new-password" : "current-password"} /></Field>
<Field><FieldLabel htmlFor="password">รหัสผ่าน</FieldLabel><Input id="password" name="password" type="password" required minLength={6} autoComplete={register ? "new-password" : "current-password"} /></Field>
{captcha && <div ref={container} />}
<Button type="submit" disabled={busy || (captcha && !token)}>{busy ? "กำลังดำเนินการ..." : register ? "สมัครสมาชิก" : "เข้าสู่ระบบ"}</Button>
</FieldGroup></form>
+2 -2
View File
@@ -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();
+1 -1
View File
@@ -53,7 +53,7 @@ function createAuth() {
emailAndPassword: {
enabled: true,
disableSignUp: false,
minPasswordLength: 12,
minPasswordLength: 6,
maxPasswordLength: 128,
},
advanced: {