Merge pull request #4760 from dignow/fix/desktop_oidc_login
fix, desktop, oidc login
This commit is contained in:
		
						commit
						b9652d165b
					
				| @ -56,7 +56,7 @@ pub struct WhitelistItem { | |||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone, Serialize, Deserialize, Default)] | #[derive(Debug, Clone, Serialize, Deserialize, Default)] | ||||||
| pub struct UserInfo { | pub struct UserInfo { | ||||||
|     #[serde(default)] |     #[serde(default, flatten)] | ||||||
|     pub settings: UserSettings, |     pub settings: UserSettings, | ||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|     pub login_device_whitelist: Vec<WhitelistItem>, |     pub login_device_whitelist: Vec<WhitelistItem>, | ||||||
| @ -83,11 +83,16 @@ pub enum UserStatus { | |||||||
| #[derive(Debug, Clone, Serialize, Deserialize)] | #[derive(Debug, Clone, Serialize, Deserialize)] | ||||||
| pub struct UserPayload { | pub struct UserPayload { | ||||||
|     pub name: String, |     pub name: String, | ||||||
|  |     #[serde(default)] | ||||||
|     pub email: Option<String>, |     pub email: Option<String>, | ||||||
|  |     #[serde(default)] | ||||||
|     pub note: Option<String>, |     pub note: Option<String>, | ||||||
|  |     #[serde(default)] | ||||||
|     pub status: UserStatus, |     pub status: UserStatus, | ||||||
|     pub info: UserInfo, |     pub info: UserInfo, | ||||||
|  |     #[serde(default)] | ||||||
|     pub is_admin: bool, |     pub is_admin: bool, | ||||||
|  |     #[serde(default)] | ||||||
|     pub third_auth_type: Option<String>, |     pub third_auth_type: Option<String>, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -117,6 +122,12 @@ pub struct AuthResult { | |||||||
|     pub auth_body: Option<AuthBody>, |     pub auth_body: Option<AuthBody>, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | impl Default for UserStatus { | ||||||
|  |     fn default() -> Self { | ||||||
|  |         UserStatus::Normal | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| impl OidcSession { | impl OidcSession { | ||||||
|     fn new() -> Self { |     fn new() -> Self { | ||||||
|         Self { |         Self { | ||||||
| @ -216,7 +227,7 @@ impl OidcSession { | |||||||
|         let query_timeout = OIDC_SESSION.read().unwrap().query_timeout; |         let query_timeout = OIDC_SESSION.read().unwrap().query_timeout; | ||||||
|         while OIDC_SESSION.read().unwrap().keep_querying && begin.elapsed() < query_timeout { |         while OIDC_SESSION.read().unwrap().keep_querying && begin.elapsed() < query_timeout { | ||||||
|             match Self::query(&code_url.code, &id, &uuid) { |             match Self::query(&code_url.code, &id, &uuid) { | ||||||
|                 Ok(HbbHttpResponse::<_>::Data(mut auth_body)) => { |                 Ok(HbbHttpResponse::<_>::Data(auth_body)) => { | ||||||
|                     if remember_me { |                     if remember_me { | ||||||
|                         LocalConfig::set_option( |                         LocalConfig::set_option( | ||||||
|                             "access_token".to_owned(), |                             "access_token".to_owned(), | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user