Fix gallery issues: user uploads, error messages, and translations

- Fix user upload feature not showing in gallery
  - Add allow_user_uploads and upload_category_id to auth response
  - These fields are required for the gallery to show the upload button

- Improve gallery login error messages
  - Add specific translations for wrong password vs rate limiting
  - Map backend error messages to user-friendly translations
  - Added auth.wrongPassword and auth.tooManyAttempts keys

- Gallery pages already have full translation support
  - GalleryPage and GalleryView use i18n properly
  - All text is translated based on selected language

These fixes resolve:
1. User upload button not showing even when enabled
2. Generic error messages for wrong passwords
3. No feedback for rate limiting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-09 09:03:14 +02:00
parent 472445a2e5
commit 9c1e79b5a5
4 changed files with 17 additions and 2 deletions
+3 -1
View File
@@ -115,7 +115,9 @@ router.post('/gallery/verify', [
event_date: event.event_date,
welcome_message: event.welcome_message,
color_theme: event.color_theme,
expires_at: event.expires_at
expires_at: event.expires_at,
allow_user_uploads: event.allow_user_uploads,
upload_category_id: event.upload_category_id
}
});
} catch (error) {
+2
View File
@@ -99,6 +99,8 @@
"enterPassword": "Galerie-Passwort eingeben",
"passwordPlaceholder": "Geben Sie das Galerie-Passwort ein",
"invalidPassword": "Ungültiges Passwort",
"wrongPassword": "Falsches Passwort. Bitte überprüfen Sie Ihr Passwort und versuchen Sie es erneut.",
"tooManyAttempts": "Zu viele fehlgeschlagene Anmeldeversuche. Bitte versuchen Sie es später erneut.",
"sessionExpired": "Sitzung abgelaufen",
"pleaseEnterPassword": "Bitte geben Sie ein Passwort ein",
"passwordHint": "Das Passwort wurde vom Veranstalter bereitgestellt. Kontaktieren Sie ihn, wenn Sie es nicht haben."
+2
View File
@@ -99,6 +99,8 @@
"enterPassword": "Enter Gallery Password",
"passwordPlaceholder": "Enter the gallery password",
"invalidPassword": "Invalid password",
"wrongPassword": "Incorrect password. Please check your password and try again.",
"tooManyAttempts": "Too many failed login attempts. Please try again later.",
"sessionExpired": "Session expired",
"pleaseEnterPassword": "Please enter a password",
"passwordHint": "The password was provided by the event organizer. Contact them if you don't have it."
+10 -1
View File
@@ -66,7 +66,16 @@ export const GalleryPage: React.FC = () => {
success: true
});
} catch (error: any) {
setLoginError(error.response?.data?.error || t('auth.invalidPassword'));
const errorMessage = error.response?.data?.error || 'Invalid password';
// Map backend error messages to user-friendly translations
if (errorMessage.toLowerCase().includes('invalid password')) {
setLoginError(t('auth.wrongPassword'));
} else if (error.response?.status === 429 || errorMessage.toLowerCase().includes('too many')) {
setLoginError(t('auth.tooManyAttempts'));
} else {
setLoginError(t('auth.invalidPassword'));
}
// Track failed password entry
analyticsService.trackGalleryEvent('password_entry', {