This commit is contained in:
Kinfe123
2025-04-13 14:05:39 +03:00
parent 2ee923f64e
commit c8b52765e2
3 changed files with 6 additions and 5 deletions

View File

@@ -5,7 +5,7 @@ import useMeasure from "react-use-measure";
import Link from "next/link";
import clsx from "clsx";
import { Button } from "@/components/ui/button";
import { Check, Copy, CornerRightUp } from "lucide-react";
import { Check, Copy } from "lucide-react";
import { useTheme } from "next-themes";
import { Highlight, themes } from "prism-react-renderer";
import { AnimatePresence, motion, MotionConfig } from "framer-motion";

View File

@@ -22,7 +22,9 @@ describe("have-i-been-pwned", async () => {
});
expect(result.error).not.toBeNull();
expect(result.error?.status).toBe(400);
expect(result.error?.code).toBe("THE_PASSWORD_YOU_ENTERED_HAS_BEEN_COMPROMISED_PLEASE_CHOOSE_A_DIFFERENT_PASSWORD");
expect(result.error?.code).toBe(
"THE_PASSWORD_YOU_ENTERED_HAS_BEEN_COMPROMISED_PLEASE_CHOOSE_A_DIFFERENT_PASSWORD",
);
});
it("should allow account creation with strong, uncompromised password", async () => {
@@ -61,4 +63,3 @@ describe("have-i-been-pwned", async () => {
expect(result.error?.status).toBe(400);
});
});

View File

@@ -4,7 +4,8 @@ import { betterFetch } from "@better-fetch/fetch";
import type { BetterAuthPlugin } from "../../types";
const ERROR_CODES = {
PASSWORD_COMPROMISED: "THE_PASSWORD_YOU_ENTERED_HAS_BEEN_COMPROMISED_PLEASE_CHOOSE_A_DIFFERENT_PASSWORD",
PASSWORD_COMPROMISED:
"THE_PASSWORD_YOU_ENTERED_HAS_BEEN_COMPROMISED_PLEASE_CHOOSE_A_DIFFERENT_PASSWORD",
} as const;
async function checkPasswordCompromise(
@@ -74,7 +75,6 @@ export const haveIBeenPwned = (options?: HaveIBeenPwnedOptions) =>
);
return ctx.password.hash(password);
},
},
},
};