fix
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 13m11s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 13m11s
This commit is contained in:
parent
308639e418
commit
eb436cf14c
@ -29,7 +29,7 @@ pub async fn rate_limiting_middleware(
|
||||
let mut entry = state
|
||||
.rate_limit
|
||||
.entry(client_ip)
|
||||
.or_insert_with(|| crate::state::TokenBucket::new());
|
||||
.or_insert_with(crate::state::TokenBucket::new);
|
||||
entry.value_mut().take()
|
||||
};
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use sqlx::{Executor, PgPool, Postgres, types::Uuid};
|
||||
use sqlx::{Executor, Postgres, types::Uuid};
|
||||
|
||||
use crate::{db::model::user::User, errors::AppError};
|
||||
|
||||
|
||||
@ -59,7 +59,10 @@ pub async fn register(
|
||||
|
||||
let mut tx = state.db.begin().await?;
|
||||
|
||||
if let Some(_) = user_repository::get_user_by_email(&mut *tx, &req.email).await? {
|
||||
if user_repository::get_user_by_email(&mut *tx, &req.email)
|
||||
.await?
|
||||
.is_some()
|
||||
{
|
||||
tracing::warn!(email = %req.email, "Registration failed: email already exists");
|
||||
return Err(AppError::Validation("bad request".to_string()));
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ pub fn generate_refresh_token() -> (String, String) {
|
||||
let mut thread_rng = rand::rng();
|
||||
thread_rng.fill_bytes(&mut bytes);
|
||||
|
||||
let plain = hex::encode(&bytes); // 64 hex chars for user
|
||||
let plain = hex::encode(bytes); // 64 hex chars for user
|
||||
let hash = {
|
||||
// SHA-256 for DB storage
|
||||
let mut hasher = Sha256::new();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user