Skip to content

Commit

Permalink
feat(neon_framework): Add error message for bruteforce throttling
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <kate@provokateurin.de>
  • Loading branch information
provokateurin committed Jul 29, 2024
1 parent 810a3c3 commit 73a91ae
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/neon_framework/lib/l10n/en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"loginMaintenanceModeDisabled": "Maintenance mode disabled",
"loginCheckingAccount": "Checking account",
"errorCredentialsForAccountNoLongerMatch": "The credentials for this account no longer match",
"errorBruteforceThrottled": "Your requests are throttled at the moment due to brute force protection",
"errorServerHadAProblemProcessingYourRequest": "The server had a problem while processing your request. You might want to try again",
"errorSomethingWentWrongTryAgainLater": "Something went wrong. Please try again later",
"errorUnableToReachServer": "Unable to reach the server",
Expand Down
6 changes: 6 additions & 0 deletions packages/neon_framework/lib/l10n/localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ abstract class NeonLocalizations {
/// **'The credentials for this account no longer match'**
String get errorCredentialsForAccountNoLongerMatch;

/// No description provided for @errorBruteforceThrottled.
///
/// In en, this message translates to:
/// **'Your requests are throttled at the moment due to brute force protection'**
String get errorBruteforceThrottled;

/// No description provided for @errorServerHadAProblemProcessingYourRequest.
///
/// In en, this message translates to:
Expand Down
3 changes: 3 additions & 0 deletions packages/neon_framework/lib/l10n/localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class NeonLocalizationsEn extends NeonLocalizations {
@override
String get errorCredentialsForAccountNoLongerMatch => 'The credentials for this account no longer match';

@override
String get errorBruteforceThrottled => 'Your requests are throttled at the moment due to brute force protection';

@override
String get errorServerHadAProblemProcessingYourRequest =>
'The server had a problem while processing your request. You might want to try again';
Expand Down
5 changes: 5 additions & 0 deletions packages/neon_framework/lib/src/widgets/error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ class NeonError extends StatelessWidget {
isUnauthorized: true,
);
}
if (error.statusCode == 429) {
return NeonExceptionDetails(
getText: (context) => NeonLocalizations.of(context).errorBruteforceThrottled,
);
}
if (error.statusCode >= 500 && error.statusCode <= 599) {
return NeonExceptionDetails(
getText: (context) => NeonLocalizations.of(context).errorServerHadAProblemProcessingYourRequest,
Expand Down

0 comments on commit 73a91ae

Please sign in to comment.