✨ (auth): Añade idioma y tema preferidos al usuario
- CurrentUser pasa de enum a struct con `id` opcional (anónimo = None) y preferencias de idioma, zona horaria y tema validadas en `with_*()`. - `RequestLocale` tiene en cuenta el idioma preferido del usuario, y Context usa su tema si lo tiene (`default_theme()` en otro caso). - Nuevos componentes `form::SelectLanguage`, `form::SelectTheme` y `form::SelectTimezone`, con `Timezone::supported_by_region()` para listar y validar las zonas IANA ofrecidas.
This commit is contained in:
parent
35f2b66161
commit
70744a51a5
25 changed files with 1162 additions and 190 deletions
|
|
@ -23,11 +23,7 @@ async fn resolve_uses_the_timezone_already_resolved_by_the_authenticated_user()
|
|||
|
||||
let madrid: Tz = "Europe/Madrid".parse().unwrap();
|
||||
let req = web::test::TestRequest::get()
|
||||
.with_extension(CurrentUser::Authenticated {
|
||||
id: 1,
|
||||
display_name: "Alice".to_owned(),
|
||||
timezone: Some(madrid),
|
||||
})
|
||||
.with_extension(CurrentUser::authenticated(1, "Alice").with_timezone("Europe/Madrid"))
|
||||
.to_http_request();
|
||||
let cx = Context::new(req);
|
||||
assert_eq!(cx.timezone(), madrid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue