From 5ee0d0c99470e6244256d6c3bf602107fa21ed44 Mon Sep 17 00:00:00 2001 From: dignow Date: Sat, 24 Jun 2023 20:19:53 +0800 Subject: [PATCH] fix, desktop, oidc login Signed-off-by: dignow --- src/hbbs_http/account.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/hbbs_http/account.rs b/src/hbbs_http/account.rs index a2ef53029..218211c47 100644 --- a/src/hbbs_http/account.rs +++ b/src/hbbs_http/account.rs @@ -83,11 +83,16 @@ pub enum UserStatus { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct UserPayload { pub name: String, + #[serde(default)] pub email: Option, + #[serde(default)] pub note: Option, + #[serde(default)] pub status: UserStatus, pub info: UserInfo, + #[serde(default)] pub is_admin: bool, + #[serde(default)] pub third_auth_type: Option, } @@ -117,6 +122,12 @@ pub struct AuthResult { pub auth_body: Option, } +impl Default for UserStatus { + fn default() -> Self { + UserStatus::Normal + } +} + impl OidcSession { fn new() -> Self { Self { @@ -216,7 +227,7 @@ impl OidcSession { let query_timeout = OIDC_SESSION.read().unwrap().query_timeout; while OIDC_SESSION.read().unwrap().keep_querying && begin.elapsed() < query_timeout { match Self::query(&code_url.code, &id, &uuid) { - Ok(HbbHttpResponse::<_>::Data(mut auth_body)) => { + Ok(HbbHttpResponse::<_>::Data(auth_body)) => { if remember_me { LocalConfig::set_option( "access_token".to_owned(),