Fix rate limit UX and decrease lockout time
This commit is contained in:
1 parent
c652a19a43
commit
304a30c7c2
2 files changed
+7
-1
No files matched your search
@@ -23,9 +23,13 @@ export default function AdminLoginPage() {
|
||||
|
||||
if (res.ok) {
|
||||
router.push('/admin');
|
||||
} else {
|
||||
if (res.status === 429) {
|
||||
setError('Zu viele Fehlversuche! Bitte warte 3 Minuten.');
|
||||
} else {
|
||||
setError('Falsches Passwort');
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
setError('Ein Fehler ist aufgetreten');
|
||||
} finally {
|
||||
@@ -56,3 +60,4 @@ export default function AdminLoginPage() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface RateLimitConfig {
|
||||
export const RATE_LIMITS = {
|
||||
login: {
|
||||
maxRequests: 5,
|
||||
windowSeconds: 15 * 60, // 15 minutes
|
||||
windowSeconds: 3 * 60, // 3 minutes
|
||||
prefix: 'rl:login',
|
||||
},
|
||||
like: {
|
||||
@@ -140,3 +140,4 @@ export function addRateLimitHeaders(
|
||||
headers.set('Retry-After', Math.ceil((result.resetAt.getTime() - Date.now()) / 1000).toString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user