Test for user system and comments

This commit is contained in:
Alphonse Paix
2025-10-06 02:08:26 +02:00
parent d96a29ee73
commit 04c2d2b7f5
12 changed files with 501 additions and 29 deletions

View File

@@ -62,7 +62,10 @@ impl TryFrom<CreateUserForm> for NewUser {
anyhow::bail!("Password mismatch.");
}
let role = value.admin.map(|_| Role::Admin).unwrap_or(Role::Writer);
let role = match value.admin {
Some(true) => Role::Admin,
_ => Role::Writer,
};
let password_hash = crate::authentication::compute_pasword_hash(value.password)
.context("Failed to hash password.")?;
Ok(Self {