diff --git a/components/passwordStrengthBar.tsx b/components/passwordStrengthBar.tsx new file mode 100644 index 00000000..b78bb721 --- /dev/null +++ b/components/passwordStrengthBar.tsx @@ -0,0 +1,60 @@ +"use client"; + +import { calculatePasswordStrength } from "@/utils/passwordStrength"; + +interface PasswordStrengthBarProps { + password: string; +} + +export default function PasswordStrengthBar({ + password, +}: PasswordStrengthBarProps) { + const { score, label } = calculatePasswordStrength(password); + + const colors = { + 0: "bg-zinc-700", + 1: "bg-red-500", + 2: "bg-yellow-400", + 3: "bg-lime-400", + 4: "bg-green-500", + }; + + const textColors = { + 0: "text-zinc-500", + 1: "text-red-400", + 2: "text-yellow-400", + 3: "text-lime-400", + 4: "text-green-400", + }; + + if (!password) return null; + + return ( +
- Enter and confirm your new password. + Enter and confirm your new password.
+ {error && ( -{error}
++ {error} +
)} +Choose a secure password for your account.
+
Don't share your password. Don't use the
same password as your Roblox account.
diff --git a/pages/welcome.tsx b/pages/welcome.tsx
index aa5ffc26..7c10091b 100644
--- a/pages/welcome.tsx
+++ b/pages/welcome.tsx
@@ -10,6 +10,8 @@ import axios from "axios";
import { toast } from "react-hot-toast";
import { IconCheck, IconEye, IconEyeOff, IconInfoCircle, IconX } from "@tabler/icons-react";
import { getContrastColor } from "@/utils/color";
+import PasswordStrengthBar from "@/components/passwordStrengthBar";
+import { calculatePasswordStrength } from "@/utils/passwordStrength";
type FormData = {
username: string;
@@ -33,6 +35,8 @@ const Login: NextPage = () => {
const [ocLoading, setOcLoading] = useState(false);
const [showApiKey, setShowApiKey] = useState(false);
const testedKey = useRef Make your Orbit account
+ Make your Orbit account
+
You need to create an Orbit account to continue
{signupform.formState.errors.username.message}
{signupform.formState.errors.password.message}
@@ -389,12 +410,13 @@ const Login: NextPage = () => {
type="password"
{...signupform.register("verifypassword", {
required: "Please verify your password",
- validate: value =>
- value === signupform.getValues('password') ||
- "Passwords do not match"
+ validate: (value) =>
+ value === signupform.getValues("password") ||
+ "Passwords do not match",
})}
label="Verify password"
/>
+
{signupform.formState.errors.verifypassword && (
{signupform.formState.errors.verifypassword.message}
@@ -411,14 +433,19 @@ const Login: NextPage = () => {
>
Back
+