From 6e6c4ee72b599ab2c40bd7fca4584405da965b76 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 21 Nov 2024 10:28:00 +0530 Subject: [PATCH] Move --- .../accounts/components/PasswordStrength.tsx | 2 +- web/packages/accounts/components/SetPasswordForm.tsx | 2 +- web/packages/accounts/components/SignUp.tsx | 2 +- .../accounts/utils/{index.ts => password.ts} | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) rename web/packages/accounts/utils/{index.ts => password.ts} (65%) diff --git a/web/packages/accounts/components/PasswordStrength.tsx b/web/packages/accounts/components/PasswordStrength.tsx index a5ee4c5fff..598dff819c 100644 --- a/web/packages/accounts/components/PasswordStrength.tsx +++ b/web/packages/accounts/components/PasswordStrength.tsx @@ -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; diff --git a/web/packages/accounts/components/SetPasswordForm.tsx b/web/packages/accounts/components/SetPasswordForm.tsx index aaff1fcb26..53be317c31 100644 --- a/web/packages/accounts/components/SetPasswordForm.tsx +++ b/web/packages/accounts/components/SetPasswordForm.tsx @@ -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"; diff --git a/web/packages/accounts/components/SignUp.tsx b/web/packages/accounts/components/SignUp.tsx index 9cda4607b1..0bdab315c5 100644 --- a/web/packages/accounts/components/SignUp.tsx +++ b/web/packages/accounts/components/SignUp.tsx @@ -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"; diff --git a/web/packages/accounts/utils/index.ts b/web/packages/accounts/utils/password.ts similarity index 65% rename from web/packages/accounts/utils/index.ts rename to web/packages/accounts/utils/password.ts index 7383354029..6b80dd76ed 100644 --- a/web/packages/accounts/utils/index.ts +++ b/web/packages/accounts/utils/password.ts @@ -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";