Ajoute l'authentification et le partage de listes

- Inscription / connexion par email + mot de passe (argon2), prénom ou
  pseudo enregistré ; session par cookie HttpOnly, jeton haché en base.
- Listes privées par propriétaire, partageables par email ; les membres
  peuvent gérer les articles et quitter la liste.
- Contrôle d'accès dans chaque server function.
- Suggestions propres à chaque utilisateur.
- Avatar avec initiales et feuille de compte (déconnexion).
- La page 404 reçoit le pool SQLite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Romulus21andClaude Opus 5.5 committed 2026-10-09 12:47:09 +02:00
1 parent 9536cf0dbe
commit cbda09ed40
12 files changed
+1083 -60

No files matched your search

+39
View File
@@ -28,6 +28,37 @@ pub struct ShoppingList {
pub name: String,
pub color: ListColor,
pub created_at: String,
/// False when the list was shared with the current user.
pub is_owner: bool,
pub owner_name: String,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct User {
pub id: i64,
pub name: String,
pub email: String,
}
impl User {
/// "Camille Lefèvre" → "CL", "romain" → "RO".
pub fn initials(&self) -> String {
let words: Vec<&str> = self.name.split_whitespace().collect();
let initials: String = match words.as_slice() {
[first, second, ..] => first.chars().take(1).chain(second.chars().take(1)).collect(),
[single] => single.chars().take(2).collect(),
[] => String::new(),
};
initials.to_uppercase()
}
}
/// Someone a list is shared with.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Member {
pub user_id: i64,
pub name: String,
pub email: String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
@@ -231,6 +262,14 @@ mod tests {
assert_eq!(q(1.5, Unit::Litre), "1,5 L");
}
#[test]
fn initials() {
let user = |name: &str| User { id: 1, name: name.into(), email: String::new() };
assert_eq!(user("Camille Lefèvre").initials(), "CL");
assert_eq!(user("romain").initials(), "RO");
assert_eq!(user("élise").initials(), "ÉL");
}
#[test]
fn text_roundtrip() {
for icon in Icon::ALL {