mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Fixed breached pwd error messages
This commit is contained in:
@@ -234,8 +234,9 @@
|
||||
"validate-base": "Password should contain:",
|
||||
"validate-too-short": "at least 14 characters",
|
||||
"validate-too-long": "at most 100 characters",
|
||||
"validate-number": "at least 1 number",
|
||||
"validate-case": "at least 1 lowercase character",
|
||||
"validate-number": "at least 1 number"
|
||||
"validate-breached": "The password you provided is in a list of passwords commonly used on other websites. Please try again with a stronger password."
|
||||
},
|
||||
"token": {
|
||||
"service-tokens": "Service Tokens",
|
||||
|
||||
@@ -231,8 +231,8 @@
|
||||
"validate-base": "La contraseña debe contener:",
|
||||
"validate-too-short": "como mínimo 14 caracteres",
|
||||
"validate-too-long": "como máximo 100 caracteres",
|
||||
"validate-case": "como mínimo 1 letra en minúsculas",
|
||||
"validate-number": "como mínimo 1 número"
|
||||
"validate-number": "como mínimo 1 número",
|
||||
"validate-case": "como mínimo 1 letra en minúsculas"
|
||||
},
|
||||
"token": {
|
||||
"service-tokens": "Tokens de servicio",
|
||||
|
||||
@@ -218,8 +218,8 @@
|
||||
"validate-base": "Le mot de passe doit contenir:",
|
||||
"validate-too-short": "au moins 14 caractères",
|
||||
"validate-too-long": "au maximum 100 caractères",
|
||||
"validate-case": "au moins 1 caractère miniscule",
|
||||
"validate-number": "au moins 1 chiffre"
|
||||
"validate-number": "au moins 1 chiffre",
|
||||
"validate-case": "au moins 1 caractère miniscule"
|
||||
},
|
||||
"token": {
|
||||
"service-tokens": "Jetons de service",
|
||||
|
||||
@@ -185,8 +185,8 @@
|
||||
"validate-base": "비밀번호는 다음 조건을 만족해야 합니다:",
|
||||
"validate-too-short": "14 글자 이상",
|
||||
"validate-too-long": "100 자 이하",
|
||||
"validate-case": "1개 이상의 소문자",
|
||||
"validate-number": "1개 이상의 숫자"
|
||||
"validate-number": "1개 이상의 숫자",
|
||||
"validate-case": "1개 이상의 소문자"
|
||||
},
|
||||
"token": {
|
||||
"add-dialog": {
|
||||
|
||||
@@ -213,8 +213,8 @@
|
||||
"validate-base": "A senha deve conter:",
|
||||
"validate-too-short": "pelo menos 14 caracteres",
|
||||
"validate-too-long": "no máximo 100 caracteres",
|
||||
"validate-case": "pelo menos 1 caractere minúsculo",
|
||||
"validate-number": "pelo menos 1 número"
|
||||
"validate-number": "pelo menos 1 número",
|
||||
"validate-case": "pelo menos 1 caractere minúsculo"
|
||||
},
|
||||
"token": {
|
||||
"service-tokens": "Tokens de Serviço",
|
||||
|
||||
@@ -231,8 +231,8 @@
|
||||
"validate-base": "Şifre kısıtlamaları:",
|
||||
"validate-too-short": "en az 14 karakter",
|
||||
"validate-too-long": "en fazla 100 karakter",
|
||||
"validate-case": "en az 1 küçük harf",
|
||||
"validate-number": "en az 1 rakam"
|
||||
"validate-number": "en az 1 rakam",
|
||||
"validate-case": "en az 1 küçük harf"
|
||||
},
|
||||
"token": {
|
||||
"service-tokens": "Servis Belirteçleri",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { checkIsPasswordBreached } from "./checkIsPasswordBreached";
|
||||
|
||||
/* eslint-disable no-param-reassign */
|
||||
interface PasswordCheckProps {
|
||||
password: string;
|
||||
@@ -6,17 +8,19 @@ interface PasswordCheckProps {
|
||||
setPasswordErrorTooLong: (value: boolean) => void;
|
||||
setPasswordErrorNumber: (value: boolean) => void;
|
||||
setPasswordErrorLowerCase: (value: boolean) => void;
|
||||
setPasswordErrorIsBreached: (value: boolean) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks a user password with respect to some criteria.
|
||||
*/
|
||||
const passwordCheck = ({
|
||||
const passwordCheck = async ({
|
||||
password,
|
||||
setPasswordErrorTooShort,
|
||||
setPasswordErrorTooLong,
|
||||
setPasswordErrorNumber,
|
||||
setPasswordErrorLowerCase,
|
||||
setPasswordErrorIsBreached,
|
||||
errorCheck
|
||||
}: PasswordCheckProps) => {
|
||||
if (!password || password.length < 14) {
|
||||
@@ -57,6 +61,13 @@ const passwordCheck = ({
|
||||
setPasswordErrorLowerCase(false);
|
||||
}
|
||||
|
||||
if (await checkIsPasswordBreached(password)) {
|
||||
setPasswordErrorIsBreached(true);
|
||||
errorCheck = true;
|
||||
} else {
|
||||
setPasswordErrorIsBreached(false);
|
||||
}
|
||||
|
||||
// if (!/[A-Z]/.test(password)) {
|
||||
// setPasswordErrorUpperCase(true);
|
||||
// errorCheck = true;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { checkIsPasswordBreached } from "./checkIsPasswordBreached";
|
||||
|
||||
type Errors = {
|
||||
tooShort?: string,
|
||||
tooLong?: string,
|
||||
upperCase?: string,
|
||||
lowerCase?: string,
|
||||
number?: string,
|
||||
specialChar?: string,
|
||||
repeatedChar?: string,
|
||||
commonPassword?: string,
|
||||
breachedPassword?: string
|
||||
tooShort?: string;
|
||||
tooLong?: string;
|
||||
upperCase?: string;
|
||||
lowerCase?: string;
|
||||
number?: string;
|
||||
specialChar?: string;
|
||||
repeatedChar?: string;
|
||||
commonPassword?: string;
|
||||
breachedPassword?: string;
|
||||
};
|
||||
|
||||
interface CheckPasswordParams {
|
||||
@@ -42,8 +42,6 @@ const checkPassword = async ({
|
||||
}: CheckPasswordParams): Promise<boolean> => {
|
||||
const errors: Errors = {};
|
||||
|
||||
const isBreachedPassword = await checkIsPasswordBreached(password)
|
||||
|
||||
if (password.length < 14) {
|
||||
errors.tooShort = "at least 14 characters";
|
||||
}
|
||||
@@ -76,12 +74,13 @@ const checkPassword = async ({
|
||||
errors.commonPassword = "No common passwords";
|
||||
}
|
||||
|
||||
if (isBreachedPassword) {
|
||||
errors.breachedPassword = "The password you provided is in a list of passwords commonly used on other websites. Please try again with a stronger password.";
|
||||
if (await checkIsPasswordBreached(password)) {
|
||||
errors.breachedPassword =
|
||||
"The password you provided is in a list of passwords commonly used on other websites. Please try again with a stronger password.";
|
||||
}
|
||||
|
||||
setErrors(errors);
|
||||
return Object.keys(errors).length > 0;
|
||||
}
|
||||
};
|
||||
|
||||
export default checkPassword;
|
||||
Reference in New Issue
Block a user