This commit is contained in:
Manav Rathi 2024-11-21 10:28:00 +05:30
parent 0fa7da8bb6
commit 6e6c4ee72b
No known key found for this signature in database
4 changed files with 9 additions and 9 deletions

View File

@ -1,8 +1,8 @@
import { estimatePasswordStrength } from "@/accounts/utils";
import { FlexWrapper } from "@ente/shared/components/Container";
import { Typography } from "@mui/material";
import { t } from "i18next";
import React, { useMemo } from "react";
import { estimatePasswordStrength } from "../utils/password";
interface PasswordStrengthHintProps {
password: string;

View File

@ -1,4 +1,4 @@
import { isWeakPassword } from "@/accounts/utils";
import { isWeakPassword } from "@/accounts/utils/password";
import { LoadingButton } from "@/base/components/mui/LoadingButton";
import ShowHidePassword from "@ente/shared/components/Form/ShowHidePassword";
import { Box, Input, TextField, Typography } from "@mui/material";

View File

@ -2,7 +2,7 @@ import { sendOtt } from "@/accounts/api/user";
import { PasswordStrengthHint } from "@/accounts/components/PasswordStrength";
import { PAGES } from "@/accounts/constants/pages";
import { generateKeyAndSRPAttributes } from "@/accounts/services/srp";
import { isWeakPassword } from "@/accounts/utils";
import { isWeakPassword } from "@/accounts/utils/password";
import { FormPaperFooter, FormPaperTitle } from "@/base/components/FormPaper";
import { LoadingButton } from "@/base/components/mui/LoadingButton";
import log from "@/base/log";

View File

@ -2,8 +2,9 @@ import zxcvbn from "zxcvbn";
export type PasswordStrength = "weak" | "moderate" | "strong";
export function estimatePasswordStrength(password: string): PasswordStrength {
export const estimatePasswordStrength = (
password: string,
): PasswordStrength => {
if (!password) {
return "weak";
}
@ -16,8 +17,7 @@ export function estimatePasswordStrength(password: string): PasswordStrength {
} else {
return "strong";
}
}
export const isWeakPassword = (password: string) => {
return estimatePasswordStrength(password) == "weak";
};
export const isWeakPassword = (password: string) =>
estimatePasswordStrength(password) == "weak";