feat: Send account selection prompt to IDP when account switch link is clicked

This commit is contained in:
Ginger committed 2026-07-02 16:34:38 -04:00
1 parent e2fe166d63
commit e649af33b9
3 files changed
+21 -7

No files matched your search

+11 -2
View File
@@ -24,6 +24,8 @@ pub(crate) struct LoginQuery {
pub next: Option<LoginTarget>,
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub reauthenticate: bool,
#[serde(default)]
pub intent: Option<LoginIntent>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
@@ -65,6 +67,12 @@ impl LoginTarget {
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub(crate) enum LoginIntent {
SwitchAccounts,
}
/// An extractor that fetches the authenticated user.
pub(crate) struct User<const ALLOW_LOCKED: bool = false>(Option<UserSession>);
@@ -107,7 +115,7 @@ impl<const ALLOW_LOCKED: bool> User<ALLOW_LOCKED> {
} else {
Err(WebError::LoginRequired(LoginQuery {
next: Some(or_else),
reauthenticate: false,
..Default::default()
}))
}
}
@@ -122,12 +130,13 @@ impl<const ALLOW_LOCKED: bool> User<ALLOW_LOCKED> {
Err(WebError::LoginRequired(LoginQuery {
next: Some(or_else),
reauthenticate: true,
..Default::default()
}))
}
} else {
Err(WebError::LoginRequired(LoginQuery {
next: Some(or_else),
reauthenticate: false,
..Default::default()
}))
}
}