auto-claude: subtask-1-3 - Add translation keys for rate limit messages

This commit is contained in:
2026-01-25 06:37:48 +01:00
parent 1b89129b52
commit f66580baa1
4 changed files with 53 additions and 4 deletions
+11 -4
View File
@@ -33,7 +33,8 @@ export default function LoginForm() {
const timeToReset = Math.ceil(rateLimiter.getTimeToReset(clientIp) / 1000 / 60); const timeToReset = Math.ceil(rateLimiter.getTimeToReset(clientIp) / 1000 / 60);
setIsLockedOut(true); setIsLockedOut(true);
setLockoutMinutes(timeToReset); setLockoutMinutes(timeToReset);
throw new Error(`Too many attempts. Please try again in ${timeToReset} minutes.`); const unit = timeToReset === 1 ? t('rateLimit.locked.minute') : t('rateLimit.locked.minutes');
throw new Error(t('rateLimit.locked.message', { minutes: timeToReset, unit }));
} }
const supabase = createClient(); const supabase = createClient();
@@ -69,9 +70,12 @@ export default function LoginForm() {
<div className="bg-red-500/10 border border-red-500/20 text-red-500 p-4 rounded-lg flex items-center"> <div className="bg-red-500/10 border border-red-500/20 text-red-500 p-4 rounded-lg flex items-center">
<AlertCircle className="h-5 w-5 mr-2 flex-shrink-0" /> <AlertCircle className="h-5 w-5 mr-2 flex-shrink-0" />
<div> <div>
<p className="font-medium">Account temporarily locked</p> <p className="font-medium">{t('rateLimit.locked.title')}</p>
<p className="text-sm mt-1"> <p className="text-sm mt-1">
Too many failed login attempts. Please try again in {lockoutMinutes} {lockoutMinutes === 1 ? 'minute' : 'minutes'}. {t('rateLimit.locked.message', {
minutes: lockoutMinutes,
unit: lockoutMinutes === 1 ? t('rateLimit.locked.minute') : t('rateLimit.locked.minutes')
})}
</p> </p>
</div> </div>
</div> </div>
@@ -85,7 +89,10 @@ export default function LoginForm() {
</div> </div>
{remainingAttempts !== null && remainingAttempts > 0 && ( {remainingAttempts !== null && remainingAttempts > 0 && (
<p className="text-sm mt-2 ml-7"> <p className="text-sm mt-2 ml-7">
{remainingAttempts} {remainingAttempts === 1 ? 'attempt' : 'attempts'} remaining before temporary lockout. {t('rateLimit.warning.message', {
attempts: remainingAttempts,
unit: remainingAttempts === 1 ? t('rateLimit.warning.attempt') : t('rateLimit.warning.attempts')
})}
</p> </p>
)} )}
</div> </div>
+14
View File
@@ -50,5 +50,19 @@ export const login = {
security: { security: {
secureConnection: 'Sichere Verbindung', secureConnection: 'Sichere Verbindung',
privacyNote: 'Ihre Daten werden verschlüsselt übertragen' privacyNote: 'Ihre Daten werden verschlüsselt übertragen'
},
// Ratenbegrenzung
rateLimit: {
locked: {
title: 'Konto vorübergehend gesperrt',
message: 'Zu viele fehlgeschlagene Anmeldeversuche. Bitte versuchen Sie es in {minutes} {unit} erneut.',
minute: 'Minute',
minutes: 'Minuten'
},
warning: {
message: '{attempts} {unit} verbleibend vor vorübergehender Sperrung.',
attempt: 'Versuch',
attempts: 'Versuche'
}
} }
}; };
+14
View File
@@ -50,5 +50,19 @@ export const login = {
security: { security: {
secureConnection: 'Secure Connection', secureConnection: 'Secure Connection',
privacyNote: 'Your data is transmitted encrypted' privacyNote: 'Your data is transmitted encrypted'
},
// Rate limiting
rateLimit: {
locked: {
title: 'Account temporarily locked',
message: 'Too many failed login attempts. Please try again in {minutes} {unit}.',
minute: 'minute',
minutes: 'minutes'
},
warning: {
message: '{attempts} {unit} remaining before temporary lockout.',
attempt: 'attempt',
attempts: 'attempts'
}
} }
}; };
+14
View File
@@ -50,5 +50,19 @@ export const login = {
security: { security: {
secureConnection: 'Bezbedna veza', secureConnection: 'Bezbedna veza',
privacyNote: 'Vaši podaci se prenose u šifrovanom obliku' privacyNote: 'Vaši podaci se prenose u šifrovanom obliku'
},
// Ograničenje broja pokušaja
rateLimit: {
locked: {
title: 'Nalog privremeno zaključan',
message: 'Previše neuspešnih pokušaja prijave. Molimo pokušajte ponovo za {minutes} {unit}.',
minute: 'minut',
minutes: 'minuta'
},
warning: {
message: '{attempts} {unit} preostalo pre privremenog zaključavanja.',
attempt: 'pokušaj',
attempts: 'pokušaja'
}
} }
}; };