jwt implementation and login, not working yet
This commit is contained in:
@@ -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),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user