Merge branch 'generate-device-name' into staging
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed

This commit is contained in:
Radical 2025-07-20 16:28:02 +02:00
commit 969b517e18
11 changed files with 1034 additions and 18 deletions

View file

@ -1,4 +1,5 @@
use std::sync::LazyLock;
use rand::{seq::IndexedRandom};
use axum::body::Bytes;
use axum_extra::extract::cookie::{Cookie, SameSite};
@ -19,6 +20,7 @@ use crate::{
error::Error,
objects::{HasIsAbove, HasUuid},
schema::users,
wordlist::{ADJECTIVES, ANIMALS}
};
pub static EMAIL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
@ -207,3 +209,12 @@ impl AppState {
.await
}
}
pub fn generate_device_name() -> String {
let mut rng = rand::rng();
let adjective = ADJECTIVES.choose(&mut rng).unwrap();
let animal = ANIMALS.choose(&mut rng).unwrap();
return [*adjective, *animal].join(" ")
}