diff --git a/migration/src/m20250108_000001_add_consent_table.rs b/migration/src/m20250108_000001_add_consent_table.rs index c5ffc49..e6e00aa 100644 --- a/migration/src/m20250108_000001_add_consent_table.rs +++ b/migration/src/m20250108_000001_add_consent_table.rs @@ -24,7 +24,12 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(Consent::Scope).string().not_null()) .col(ColumnDef::new(Consent::GrantedAt).big_integer().not_null()) .col(ColumnDef::new(Consent::ExpiresAt).big_integer()) - .col(ColumnDef::new(Consent::Revoked).integer().not_null().default(0)) + .col( + ColumnDef::new(Consent::Revoked) + .integer() + .not_null() + .default(0), + ) .to_owned(), ) .await?; diff --git a/src/web.rs b/src/web.rs index 050376c..859c67e 100644 --- a/src/web.rs +++ b/src/web.rs @@ -845,8 +845,11 @@ async fn consent_page( urlencoded(&q.code_challenge_method.as_ref().unwrap_or(&String::new())), q.state.as_ref().map(|s| format!("&state={}", urlencoded(s))).unwrap_or_default() ); - return Redirect::temporary(&format!("/login?return_to={}", urlencoded(&return_to))) - .into_response(); + return Redirect::temporary(&format!( + "/login?return_to={}", + urlencoded(&return_to) + )) + .into_response(); } }, None => { @@ -911,7 +914,13 @@ async fn consent_page( // Append query parameters to HTML let query_string = serde_urlencoded::to_string(¶ms).unwrap_or_default(); let html_with_params = if html.contains("") { - html.replace("", &format!("", query_string)) + html.replace( + "", + &format!( + "", + query_string + ), + ) } else { html }; @@ -923,13 +932,11 @@ async fn consent_page( .unwrap() .into_response() } - Err(_) => { - Response::builder() - .status(StatusCode::INTERNAL_SERVER_ERROR) - .body(Body::from("Consent page not found")) - .unwrap() - .into_response() - } + Err(_) => Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from("Consent page not found")) + .unwrap() + .into_response(), } } @@ -1019,7 +1026,10 @@ async fn consent_submit( let authorize_url = url_append_query( "/authorize".to_string(), - ¶ms.iter().map(|(k, v)| (*k, v.clone())).collect::>(), + ¶ms + .iter() + .map(|(k, v)| (*k, v.clone())) + .collect::>(), ); return Redirect::temporary(&authorize_url).into_response();