feat(auth): implement JWT authentication and user registration

- Added JWT authentication with token generation and validation.
- Introduced user registration functionality with email and password.
- Integrated Argon2 for password hashing.
- Created SQLite user repository for user data persistence.
- Updated application context to include user repository and configuration settings.
- Added environment variable support for JWT secret and registration allowance.
- Enhanced error handling for unauthorized access and validation errors.
- Updated presentation layer to handle login and registration requests.
This commit is contained in:
2026-05-04 10:43:07 +02:00
parent 98ad1b19fa
commit 1f8b24fec2
29 changed files with 599 additions and 85 deletions

View File

@@ -250,6 +250,10 @@ impl User {
}
}
pub fn from_persistence(id: UserId, email: Email, password_hash: PasswordHash) -> Self {
Self { id, email, password_hash }
}
pub fn update_password(&mut self, new_hash: PasswordHash) {
self.password_hash = new_hash;
}