feat(user.prefered_locale): save user's locale + invited have same locale as inviters

- OIDC JIT define the locale only at user creation, user can so change his preference later
    - invited users will inherit inviter's locale
    - email will use prefered_locale
    - login to a new browser will use prefered_locale
This commit is contained in:
Edouard Vanbelle
2026-06-03 14:26:45 +02:00
parent 854f1d3a07
commit 7db27af7a6
14 changed files with 342 additions and 26 deletions
+2 -2
View File
@@ -559,7 +559,7 @@ pub async fn update_profile(
let updated = auth_service
.auth_application_service
.update_profile_with_perms(user_id, dto)
.update_profile_with_perms(user_id, dto, &state.locale_registry)
.await?;
Ok((StatusCode::OK, Json(updated)))
@@ -926,7 +926,7 @@ pub async fn oidc_callback(
// Exchange code, validate state/nonce/PKCE, authenticate user
let result = auth_app
.oidc_callback(&query.code, &query.state)
.oidc_callback(&query.code, &query.state, &state.locale_registry)
.await
.map_err(|e| {
tracing::error!("OIDC callback failed: {}", e);
+8 -1
View File
@@ -137,7 +137,14 @@ pub async fn create_grant(
state.email_invite_rate_limiter.retry_after(),
);
}
match invite_svc.resolve_or_create_recipient(&email).await {
// PR C: pass the inviter id so resolve_or_create_recipient
// can inherit their preferred_locale onto a freshly-
// provisioned external user (best-effort; lookup failure
// just leaves the new row's locale NULL, no hard error).
match invite_svc
.resolve_or_create_recipient(&email, Some(caller_id))
.await
{
Ok(user) => (Subject::User(user.id()), Some(user)),
Err(e) => return AppError::from(e).into_response(),
}