Added hashing
All checks were successful
Rust Build / Check (pull_request) Successful in 1m24s
Rust Build / Test Suite (pull_request) Successful in 1m38s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / Clippy (pull_request) Successful in 1m21s
Rust Build / build (pull_request) Successful in 2m40s
All checks were successful
Rust Build / Check (pull_request) Successful in 1m24s
Rust Build / Test Suite (pull_request) Successful in 1m38s
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / Clippy (pull_request) Successful in 1m21s
Rust Build / build (pull_request) Successful in 2m40s
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use axum::{Json, http::StatusCode};
|
||||
|
||||
use crate::hashing;
|
||||
use crate::repo;
|
||||
|
||||
pub mod request {
|
||||
@@ -48,6 +49,7 @@ pub async fn register_user(
|
||||
email_verified: true,
|
||||
date_created: String::from("2025-01-01 12:00:00"),
|
||||
last_login: String::from("nil"),
|
||||
salt_id: uuid::Uuid::nil(),
|
||||
};
|
||||
|
||||
match repo::user::exists(&pool, &user.username).await {
|
||||
@@ -61,6 +63,12 @@ pub async fn register_user(
|
||||
}),
|
||||
)
|
||||
} else {
|
||||
let salt_string = hashing::generate_salt().unwrap();
|
||||
let mut salt = icarus_models::user::salt::Salt::default();
|
||||
salt.salt = salt_string.as_str().to_string();
|
||||
salt.id = repo::salt::insert(&pool, &salt).await.unwrap();
|
||||
user.salt_id = salt.id;
|
||||
|
||||
match repo::user::insert(&pool, &user).await {
|
||||
Ok(id) => {
|
||||
user.id = id;
|
||||
|
Reference in New Issue
Block a user