diff --git a/web/src/i18n/en/index.ts b/web/src/i18n/en/index.ts index 0b7e4221d5..b8254aa625 100644 --- a/web/src/i18n/en/index.ts +++ b/web/src/i18n/en/index.ts @@ -850,6 +850,7 @@ const en: BaseTranslation = { number: 'Expected a valid number.', minimumValue: `Minimum value of {value: number} not reached.`, maximumValue: 'Maximum value of {value: number} exceeded.', + tooManyBadLoginAttempts: `Too many bad login attempts. Please try again in a few minutes.`, }, floatingErrors: { title: 'Please correct the following:', diff --git a/web/src/i18n/i18n-types.ts b/web/src/i18n/i18n-types.ts index 27fd686ad4..8971bb54f2 100644 --- a/web/src/i18n/i18n-types.ts +++ b/web/src/i18n/i18n-types.ts @@ -2096,6 +2096,10 @@ type RootTranslation = { * @param {number} value */ maximumValue: RequiredParams<'value'> + /** + * T​o​o​ ​m​a​n​y​ ​b​a​d​ ​l​o​g​i​n​ ​a​t​t​e​m​p​t​s​.​ ​P​l​e​a​s​e​ ​t​r​y​ ​a​g​a​i​n​ ​i​n​ ​a​ ​f​e​w​ ​m​i​n​u​t​e​s​. + */ + tooManyBadLoginAttempts: string } floatingErrors: { /** @@ -6084,6 +6088,10 @@ export type TranslationFunctions = { * Maximum value of {value} exceeded. */ maximumValue: (arg: { value: number }) => LocalizedString + /** + * Too many bad login attempts. Please try again in a few minutes. + */ + tooManyBadLoginAttempts: () => LocalizedString } floatingErrors: { /** diff --git a/web/src/i18n/pl/index.ts b/web/src/i18n/pl/index.ts index 53484b6311..1b3cd5ffda 100644 --- a/web/src/i18n/pl/index.ts +++ b/web/src/i18n/pl/index.ts @@ -835,6 +835,8 @@ Uwaga, podane tutaj konfiguracje nie posiadają klucza prywatnego. Musisz uzupe repeat: 'Wartości się nie pokrywają.', maximumValue: 'Maksymalna wartość {value} przekroczona.', minimumValue: 'Minimalna wartość {value} nie osiągnięta.', + tooManyBadLoginAttempts: + 'Zbyt duża ilość nieprawidłowego logowania. Spróbuj ponownie za kilka minut.', number: 'Wartość musi być liczbą.', }, floatingErrors: { diff --git a/web/src/pages/auth/Login/Login.tsx b/web/src/pages/auth/Login/Login.tsx index 6d6a46a152..56c28aa4ed 100644 --- a/web/src/pages/auth/Login/Login.tsx +++ b/web/src/pages/auth/Login/Login.tsx @@ -17,6 +17,7 @@ import { import { LoaderSpinner } from '../../../shared/defguard-ui/components/Layout/LoaderSpinner/LoaderSpinner'; import { useAuthStore } from '../../../shared/hooks/store/useAuthStore'; import useApi from '../../../shared/hooks/useApi'; +import { useToaster } from '../../../shared/hooks/useToaster'; import { MutationKeys } from '../../../shared/mutations'; import { patternSafeUsernameCharacters } from '../../../shared/patterns'; import { QueryKeys } from '../../../shared/queries'; @@ -37,6 +38,7 @@ export const Login = () => { openid: { getOpenIdInfo: getOpenidInfo }, }, } = useApi(); + const toaster = useToaster(); const { data: openIdInfo, isLoading: openIdLoading } = useQuery({ queryKey: [QueryKeys.FETCH_OPENID_INFO], @@ -88,6 +90,7 @@ export const Login = () => { ); } else { console.error(error); + toaster.error(LL.form.error.tooManyBadLoginAttempts()); } }, });