mirror of
https://github.com/CloudNebulaProject/barycenter.git
synced 2026-04-10 13:10:42 +00:00
format code
Signed-off-by: Till Wegmueller <toasterson@gmail.com>
This commit is contained in:
parent
0fcd924105
commit
3f2a30cf97
2 changed files with 27 additions and 12 deletions
|
|
@ -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?;
|
||||
|
|
|
|||
24
src/web.rs
24
src/web.rs
|
|
@ -845,7 +845,10 @@ 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)))
|
||||
return Redirect::temporary(&format!(
|
||||
"/login?return_to={}",
|
||||
urlencoded(&return_to)
|
||||
))
|
||||
.into_response();
|
||||
}
|
||||
},
|
||||
|
|
@ -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("</body>") {
|
||||
html.replace("</body>", &format!("<script>window.location.search = '?{}';</script></body>", query_string))
|
||||
html.replace(
|
||||
"</body>",
|
||||
&format!(
|
||||
"<script>window.location.search = '?{}';</script></body>",
|
||||
query_string
|
||||
),
|
||||
)
|
||||
} else {
|
||||
html
|
||||
};
|
||||
|
|
@ -923,13 +932,11 @@ async fn consent_page(
|
|||
.unwrap()
|
||||
.into_response()
|
||||
}
|
||||
Err(_) => {
|
||||
Response::builder()
|
||||
Err(_) => Response::builder()
|
||||
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
||||
.body(Body::from("Consent page not found"))
|
||||
.unwrap()
|
||||
.into_response()
|
||||
}
|
||||
.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::<Vec<_>>(),
|
||||
¶ms
|
||||
.iter()
|
||||
.map(|(k, v)| (*k, v.clone()))
|
||||
.collect::<Vec<_>>(),
|
||||
);
|
||||
|
||||
return Redirect::temporary(&authorize_url).into_response();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue