feat(auth): implement user authentication and profile management

- Added authentication context and provider to manage user state.
- Created login and registration forms with validation and error handling.
- Implemented user profile component for updating user information and changing passwords.
- Introduced user settings in the database for notification preferences.
- Updated translations for authentication-related strings in English and German.
- Enhanced styles for authentication components and user profile.
- Added middleware for optional and required authentication checks.
This commit is contained in:
Daniel Volz
2025-12-26 19:57:35 +01:00
parent 5900fddb2d
commit a7f9f90db4
20 changed files with 2020 additions and 402 deletions
+225
View File
@@ -1743,6 +1743,7 @@ textarea {
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
animation: slideUp 0.3s ease;
border: 1px solid var(--border-primary);
padding: 1.5rem;
}
@keyframes slideUp {
@@ -2176,3 +2177,227 @@ h3 .reminder-icon.info-tooltip {
font-size: 0.75em;
vertical-align: middle;
}
/* =============================================================================
Auth Components
============================================================================= */
.auth-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-gradient);
padding: 1rem;
}
.auth-card {
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 16px;
padding: 2.5rem;
width: 100%;
max-width: 420px;
box-shadow: 0 10px 40px var(--shadow);
}
.auth-title {
font-size: 2rem;
font-weight: 700;
text-align: center;
margin: 0 0 0.5rem 0;
color: var(--text-primary);
}
.auth-subtitle {
font-size: 1.25rem;
font-weight: 500;
text-align: center;
margin: 0 0 1.5rem 0;
color: var(--text-secondary);
}
.auth-info {
text-align: center;
color: var(--text-secondary);
margin-bottom: 1.5rem;
padding: 1rem;
background: var(--accent-bg);
border-radius: 8px;
font-size: 0.9rem;
}
.auth-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.auth-error {
background: var(--danger-bg);
color: var(--danger);
padding: 0.75rem 1rem;
border-radius: 8px;
font-size: 0.9rem;
text-align: center;
}
.auth-success {
background: var(--success-bg);
color: var(--success);
padding: 0.75rem 1rem;
border-radius: 8px;
font-size: 0.9rem;
text-align: center;
}
.auth-submit {
margin-top: 0.5rem;
padding: 0.875rem;
font-size: 1rem;
font-weight: 600;
}
.auth-links {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.75rem;
margin-top: 1.5rem;
padding-top: 1.5rem;
border-top: 1px solid var(--border-primary);
}
.auth-link,
.auth-link-btn {
color: var(--accent);
text-decoration: none;
font-size: 0.9rem;
background: none;
border: none;
cursor: pointer;
padding: 0;
}
.auth-link:hover,
.auth-link-btn:hover {
text-decoration: underline;
color: var(--accent-light);
}
/* Profile Component */
.profile-container {
padding: 0;
}
.profile-header {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 1.5rem;
padding-right: 2.5rem; /* Space for modal close button */
}
.profile-header h2 {
margin: 0;
font-size: 1.25rem;
}
.profile-role {
background: var(--accent-bg);
color: var(--accent);
padding: 0.25rem 0.75rem;
border-radius: 100px;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
}
.profile-info {
margin-bottom: 1.5rem;
padding: 1rem;
background: var(--bg-tertiary);
border-radius: 8px;
}
.profile-info p {
margin: 0;
color: var(--text-secondary);
}
.profile-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.profile-form h3 {
margin: 0.5rem 0 0 0;
font-size: 1rem;
color: var(--text-secondary);
}
.profile-divider {
border: none;
border-top: 1px solid var(--border-primary);
margin: 0.5rem 0;
}
.profile-actions {
display: flex;
gap: 1rem;
margin-top: 0.5rem;
}
.profile-actions .btn {
flex: 1;
}
/* User Menu Button in Header */
.user-menu-btn {
display: flex;
align-items: center;
gap: 0.5rem;
background: var(--bg-tertiary);
border: 1px solid var(--border-primary);
border-radius: 100px;
padding: 0.375rem 0.75rem;
color: var(--text-primary);
cursor: pointer;
font-size: 0.875rem;
transition: all 0.2s ease;
}
.user-menu-btn:hover {
background: var(--accent-bg);
border-color: var(--accent);
}
.user-menu-btn .user-avatar {
width: 28px;
height: 28px;
background: var(--accent);
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 0.75rem;
}
@media (max-width: 600px) {
.auth-card {
padding: 1.5rem;
}
.auth-title {
font-size: 1.75rem;
}
}
/* Profile Modal */
.profile-modal {
max-width: 480px;
padding: 1.5rem;
}