mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 01:27:31 +00:00
Fix frontend lint issues
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
import { letterCharRegex, numAndSpecialCharRegex, repeatedCharRegex, escapeCharRegex, lowEntropyRegexes } from "./passwordRegexes";
|
|
||||||
import { checkIsPasswordBreached } from "./checkIsPasswordBreached";
|
import { checkIsPasswordBreached } from "./checkIsPasswordBreached";
|
||||||
|
import { escapeCharRegex, letterCharRegex, lowEntropyRegexes,numAndSpecialCharRegex, repeatedCharRegex } from "./passwordRegexes";
|
||||||
|
|
||||||
interface PasswordCheckProps {
|
interface PasswordCheckProps {
|
||||||
password: string;
|
password: string;
|
||||||
errorCheck: boolean;
|
|
||||||
setPasswordErrorTooShort: (value: boolean) => void;
|
setPasswordErrorTooShort: (value: boolean) => void;
|
||||||
setPasswordErrorTooLong: (value: boolean) => void;
|
setPasswordErrorTooLong: (value: boolean) => void;
|
||||||
setPasswordErrorNoLetterChar: (value: boolean) => void;
|
setPasswordErrorNoLetterChar: (value: boolean) => void;
|
||||||
@@ -23,9 +22,9 @@ const passwordCheck = async ({
|
|||||||
setPasswordErrorRepeatedChar,
|
setPasswordErrorRepeatedChar,
|
||||||
setPasswordErrorEscapeChar,
|
setPasswordErrorEscapeChar,
|
||||||
setPasswordErrorLowEntropy,
|
setPasswordErrorLowEntropy,
|
||||||
setPasswordErrorBreached,
|
setPasswordErrorBreached
|
||||||
errorCheck
|
|
||||||
}: PasswordCheckProps) => {
|
}: PasswordCheckProps) => {
|
||||||
|
let errorCheck = false;
|
||||||
const tests = [
|
const tests = [
|
||||||
{
|
{
|
||||||
name: "tooShort",
|
name: "tooShort",
|
||||||
@@ -74,15 +73,15 @@ const passwordCheck = async ({
|
|||||||
} else {
|
} else {
|
||||||
setPasswordErrorBreached(false);
|
setPasswordErrorBreached(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const test of tests) {
|
tests.forEach((test) => {
|
||||||
if (!test.validator(password)) {
|
if (!test.validator(password)) {
|
||||||
errorCheck = true;
|
errorCheck = true;
|
||||||
test.setError(true);
|
test.setError(true);
|
||||||
} else {
|
} else {
|
||||||
test.setError(false);
|
test.setError(false);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
return errorCheck;
|
return errorCheck;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { letterCharRegex, numAndSpecialCharRegex, repeatedCharRegex, escapeCharRegex, lowEntropyRegexes } from "./passwordRegexes";
|
|
||||||
import { checkIsPasswordBreached } from "./checkIsPasswordBreached";
|
import { checkIsPasswordBreached } from "./checkIsPasswordBreached";
|
||||||
|
import { escapeCharRegex, letterCharRegex, lowEntropyRegexes,numAndSpecialCharRegex, repeatedCharRegex } from "./passwordRegexes";
|
||||||
|
|
||||||
type Errors = {
|
type Errors = {
|
||||||
tooShort?: string;
|
tooShort?: string;
|
||||||
@@ -86,11 +86,11 @@ const checkPassword = async ({ password, setErrors }: CheckPasswordParams): Prom
|
|||||||
errors.breached = "Password was found in a data breach.";
|
errors.breached = "Password was found in a data breach.";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const test of tests) {
|
tests.forEach((test) => {
|
||||||
if (test.validator && !test.validator(password)) {
|
if (test.validator && !test.validator(password)) {
|
||||||
errors[test.name as keyof Errors] = test.errorText;
|
errors[test.name as keyof Errors] = test.errorText;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
setErrors(errors);
|
setErrors(errors);
|
||||||
return Object.keys(errors).length > 0;
|
return Object.keys(errors).length > 0;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import queryString from "query-string";
|
|||||||
|
|
||||||
import Button from "@app/components/basic/buttons/Button";
|
import Button from "@app/components/basic/buttons/Button";
|
||||||
import InputField from "@app/components/basic/InputField";
|
import InputField from "@app/components/basic/InputField";
|
||||||
import passwordCheck from "~/components/utilities/checks/password/PasswordCheck";
|
import passwordCheck from "@app/components/utilities/checks/password/PasswordCheck";
|
||||||
import Aes256Gcm from "@app/components/utilities/cryptography/aes-256-gcm";
|
import Aes256Gcm from "@app/components/utilities/cryptography/aes-256-gcm";
|
||||||
import { useResetPassword, useVerifyPasswordResetCode } from "@app/hooks/api";
|
import { useResetPassword, useVerifyPasswordResetCode } from "@app/hooks/api";
|
||||||
import { getBackupEncryptedPrivateKey } from "@app/hooks/api/auth/queries";
|
import { getBackupEncryptedPrivateKey } from "@app/hooks/api/auth/queries";
|
||||||
@@ -79,8 +79,7 @@ export default function PasswordReset() {
|
|||||||
setPasswordErrorRepeatedChar,
|
setPasswordErrorRepeatedChar,
|
||||||
setPasswordErrorEscapeChar,
|
setPasswordErrorEscapeChar,
|
||||||
setPasswordErrorLowEntropy,
|
setPasswordErrorLowEntropy,
|
||||||
setPasswordErrorBreached,
|
setPasswordErrorBreached
|
||||||
errorCheck: false
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!errorCheck) {
|
if (!errorCheck) {
|
||||||
@@ -240,8 +239,7 @@ export default function PasswordReset() {
|
|||||||
setPasswordErrorRepeatedChar,
|
setPasswordErrorRepeatedChar,
|
||||||
setPasswordErrorEscapeChar,
|
setPasswordErrorEscapeChar,
|
||||||
setPasswordErrorLowEntropy,
|
setPasswordErrorLowEntropy,
|
||||||
setPasswordErrorBreached,
|
setPasswordErrorBreached
|
||||||
errorCheck: false
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
type="password"
|
type="password"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { encodeBase64 } from "tweetnacl-util";
|
|||||||
|
|
||||||
import Button from "@app/components/basic/buttons/Button";
|
import Button from "@app/components/basic/buttons/Button";
|
||||||
import InputField from "@app/components/basic/InputField";
|
import InputField from "@app/components/basic/InputField";
|
||||||
import checkPassword from "~/components/utilities/checks/password/checkPassword";
|
import checkPassword from "@app/components/utilities/checks/password/checkPassword";
|
||||||
import Aes256Gcm from "@app/components/utilities/cryptography/aes-256-gcm";
|
import Aes256Gcm from "@app/components/utilities/cryptography/aes-256-gcm";
|
||||||
import { deriveArgonKey } from "@app/components/utilities/cryptography/crypto";
|
import { deriveArgonKey } from "@app/components/utilities/cryptography/crypto";
|
||||||
import issueBackupKey from "@app/components/utilities/cryptography/issueBackupKey";
|
import issueBackupKey from "@app/components/utilities/cryptography/issueBackupKey";
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ import * as yup from "yup";
|
|||||||
|
|
||||||
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||||
import attemptChangePassword from "@app/components/utilities/attemptChangePassword";
|
import attemptChangePassword from "@app/components/utilities/attemptChangePassword";
|
||||||
import checkPassword from "~/components/utilities/checks/password/checkPassword";
|
import checkPassword from "@app/components/utilities/checks/password/checkPassword";
|
||||||
import { Button, FormControl, Input } from "@app/components/v2";
|
import { Button, FormControl, Input } from "@app/components/v2";
|
||||||
import { useUser } from "@app/context";
|
import { useUser } from "@app/context";
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import nacl from "tweetnacl";
|
|||||||
import { encodeBase64 } from "tweetnacl-util";
|
import { encodeBase64 } from "tweetnacl-util";
|
||||||
|
|
||||||
import InputField from "@app/components/basic/InputField";
|
import InputField from "@app/components/basic/InputField";
|
||||||
import checkPassword from "~/components/utilities/checks/password/checkPassword";
|
import checkPassword from "@app/components/utilities/checks/password/checkPassword";
|
||||||
import Aes256Gcm from "@app/components/utilities/cryptography/aes-256-gcm";
|
import Aes256Gcm from "@app/components/utilities/cryptography/aes-256-gcm";
|
||||||
import { deriveArgonKey } from "@app/components/utilities/cryptography/crypto";
|
import { deriveArgonKey } from "@app/components/utilities/cryptography/crypto";
|
||||||
import { saveTokenToLocalStorage } from "@app/components/utilities/saveTokenToLocalStorage";
|
import { saveTokenToLocalStorage } from "@app/components/utilities/saveTokenToLocalStorage";
|
||||||
|
|||||||
Reference in New Issue
Block a user