jwt implementation and login, not working yet

This commit is contained in:
filipriec
2025-03-25 10:15:17 +01:00
parent 9393294af8
commit cd32c175a4
12 changed files with 318 additions and 1 deletions

View File

@@ -14,6 +14,14 @@ pub struct RegisterRequest {
pub password_confirmation: String,
}
#[derive(Debug, Validate, Deserialize)]
pub struct LoginRequest {
#[validate(length(min = 1))]
pub identifier: String,
#[validate(length(min = 1))]
pub password: String,
}
#[derive(Debug, thiserror::Error)]
pub enum AuthError {
#[error("Passwords do not match")]
@@ -24,4 +32,10 @@ pub enum AuthError {
DatabaseError(String),
#[error("Hashing error: {0}")]
HashingError(String),
#[error("Invalid credentials")]
InvalidCredentials,
#[error("JWT error: {0}")]
JwtError(String),
#[error("Configuration error: {0}")]
ConfigError(String),
}