mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 20:56:49 +00:00
feat: Send account selection prompt to IDP when account switch link is clicked
This commit is contained in:
3 files changed
+21
-7
No files matched your search
+11
-2
@@ -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()
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user