fix for resend, cooldown and a few small fixes
This commit is contained in:
8
frontend/pweb/lib/utils/cooldown_format.dart
Normal file
8
frontend/pweb/lib/utils/cooldown_format.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
String formatCooldownSeconds(int seconds) {
|
||||
final minutes = seconds ~/ 60;
|
||||
final remainingSeconds = seconds % 60;
|
||||
if (minutes > 0) {
|
||||
return '$minutes:${remainingSeconds.toString().padLeft(2, '0')}';
|
||||
}
|
||||
return remainingSeconds.toString();
|
||||
}
|
||||
@@ -15,6 +15,7 @@ class ErrorHandler {
|
||||
'account_not_verified': locs.errorAccountNotVerified,
|
||||
'unauthorized': locs.errorLoginUnauthorized,
|
||||
'verification_token_not_found': locs.errorVerificationTokenNotFound,
|
||||
'user_already_registered': locs.errorDuplicateEmail,
|
||||
'internal_error': locs.errorInternalError,
|
||||
'invalid_target': locs.errorInvalidTarget,
|
||||
'pending_token_required': locs.errorPendingTokenRequired,
|
||||
@@ -62,6 +63,9 @@ class ErrorHandler {
|
||||
}
|
||||
|
||||
static String _handleErrorResponseLocs(AppLocalizations locs, ErrorResponse e) {
|
||||
if (e.source == 'user_already_registered') {
|
||||
return locs.errorDuplicateEmail;
|
||||
}
|
||||
final errorMessages = getErrorMessagesLocs(locs);
|
||||
// Return the localized message if we recognize the error key, else use the raw details
|
||||
return errorMessages[e.error] ?? e.details;
|
||||
|
||||
Reference in New Issue
Block a user