Skip to content

Commit a5f3bd1

Browse files
[WEB-4513] refactor: consolidate password strength meter into shared ui package (#7462)
* refactor: consolidate password strength indicator into shared UI package * chore: remove old password strength meter implementations * chore: update package dependencies for password strength refactor * chore: code refactor * fix: lock file --------- Co-authored-by: sriramveeraghanta <[email protected]>
1 parent 63d025c commit a5f3bd1

File tree

25 files changed

+307
-455
lines changed

25 files changed

+307
-455
lines changed

apps/admin/core/components/common/password-strength-meter.tsx

Lines changed: 0 additions & 89 deletions
This file was deleted.

apps/admin/core/components/instance/setup-form.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import { Eye, EyeOff } from "lucide-react";
77
// plane internal packages
88
import { API_BASE_URL, E_PASSWORD_STRENGTH } from "@plane/constants";
99
import { AuthService } from "@plane/services";
10-
import { Button, Checkbox, Input, Spinner } from "@plane/ui";
10+
import { Button, Checkbox, Input, PasswordStrengthIndicator, Spinner } from "@plane/ui";
1111
import { getPasswordStrength } from "@plane/utils";
1212
// components
1313
import { Banner } from "@/components/common/banner";
14-
import { PasswordStrengthMeter } from "@/components/common/password-strength-meter";
1514

1615
// service initialization
1716
const authService = new AuthService();
@@ -274,7 +273,7 @@ export const InstanceSetupForm: FC = (props) => {
274273
{errorData.type && errorData.type === EErrorCodes.INVALID_PASSWORD && errorData.message && (
275274
<p className="px-1 text-xs text-red-500">{errorData.message}</p>
276275
)}
277-
<PasswordStrengthMeter password={formData.password} isFocused={isPasswordInputFocused} />
276+
<PasswordStrengthIndicator password={formData.password} isFocused={isPasswordInputFocused} />
278277
</div>
279278

280279
<div className="w-full space-y-1">

apps/admin/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"react-dom": "^18.3.1",
4141
"react-hook-form": "7.51.5",
4242
"swr": "^2.2.4",
43-
"uuid": "^9.0.1",
44-
"zxcvbn": "^4.4.2"
43+
"uuid": "^9.0.1"
4544
},
4645
"devDependencies": {
4746
"@plane/eslint-config": "*",
@@ -51,7 +50,6 @@
5150
"@types/react": "^18.3.11",
5251
"@types/react-dom": "^18.2.18",
5352
"@types/uuid": "^9.0.8",
54-
"@types/zxcvbn": "^4.4.4",
5553
"typescript": "5.8.3"
5654
}
5755
}

apps/space/core/components/account/auth-forms/password.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ import React, { useEffect, useMemo, useRef, useState } from "react";
44
import { observer } from "mobx-react";
55
import { Eye, EyeOff, XCircle } from "lucide-react";
66
// plane imports
7-
import { API_BASE_URL } from "@plane/constants";
7+
import { API_BASE_URL, E_PASSWORD_STRENGTH } from "@plane/constants";
88
import { AuthService } from "@plane/services";
9-
import { Button, Input, Spinner } from "@plane/ui";
10-
// components
11-
import { PasswordStrengthMeter } from "@/components/account";
12-
// helpers
13-
import { E_PASSWORD_STRENGTH, getPasswordStrength } from "@/helpers/password.helper";
9+
import { Button, Input, Spinner, PasswordStrengthIndicator } from "@plane/ui";
10+
import { getPasswordStrength } from "@plane/utils";
1411
// types
1512
import { EAuthModes, EAuthSteps } from "@/types/auth";
1613

@@ -72,7 +69,7 @@ export const AuthPasswordForm: React.FC<Props> = observer((props: Props) => {
7269
const passwordSupport = passwordFormData.password.length > 0 &&
7370
mode === EAuthModes.SIGN_UP &&
7471
getPasswordStrength(passwordFormData.password) != E_PASSWORD_STRENGTH.STRENGTH_VALID && (
75-
<PasswordStrengthMeter password={passwordFormData.password} isFocused={isPasswordInputFocused} />
72+
<PasswordStrengthIndicator password={passwordFormData.password} isFocused={isPasswordInputFocused} />
7673
);
7774

7875
const isButtonDisabled = useMemo(

apps/space/core/components/account/helpers/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/space/core/components/account/helpers/password-strength-meter.tsx

Lines changed: 0 additions & 94 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * from "./auth-forms";
22
export * from "./oauth";
33
export * from "./terms-and-conditions";
4-
export * from "./helpers";
54
export * from "./user-logged-in";

apps/space/helpers/password.helper.ts

Lines changed: 0 additions & 67 deletions
This file was deleted.

apps/space/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
"react-popper": "^2.3.0",
5050
"swr": "^2.2.2",
5151
"tailwind-merge": "^2.0.0",
52-
"uuid": "^9.0.0",
53-
"zxcvbn": "^4.4.2"
52+
"uuid": "^9.0.0"
5453
},
5554
"devDependencies": {
5655
"@plane/eslint-config": "*",
@@ -63,7 +62,6 @@
6362
"@types/react": "^18.3.11",
6463
"@types/react-dom": "^18.2.18",
6564
"@types/uuid": "^9.0.1",
66-
"@types/zxcvbn": "^4.4.4",
6765
"@typescript-eslint/eslint-plugin": "^8.36.0",
6866
"typescript": "5.8.3"
6967
}

apps/web/app/(all)/[workspaceSlug]/(settings)/settings/account/security/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import { Eye, EyeOff } from "lucide-react";
77
// plane imports
88
import { E_PASSWORD_STRENGTH } from "@plane/constants";
99
import { useTranslation } from "@plane/i18n";
10-
import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui";
10+
import { Button, Input, PasswordStrengthIndicator, TOAST_TYPE, setToast } from "@plane/ui";
1111
import { getPasswordStrength } from "@plane/utils";
1212
// components
13-
import { PasswordStrengthMeter } from "@/components/account";
1413
import { PageHead } from "@/components/core";
1514
import { ProfileSettingContentHeader } from "@/components/profile";
1615
// helpers
@@ -114,7 +113,7 @@ const SecurityPage = observer(() => {
114113

115114
const passwordSupport = password.length > 0 &&
116115
getPasswordStrength(password) != E_PASSWORD_STRENGTH.STRENGTH_VALID && (
117-
<PasswordStrengthMeter password={password} isFocused={isPasswordInputFocused} />
116+
<PasswordStrengthIndicator password={password} isFocused={isPasswordInputFocused} />
118117
);
119118

120119
const renderPasswordMatchError = !isRetryPasswordInputFocused || confirmPassword.length >= password.length;

0 commit comments

Comments
 (0)