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::Scope).string().not_null())
|
||||||
.col(ColumnDef::new(Consent::GrantedAt).big_integer().not_null())
|
.col(ColumnDef::new(Consent::GrantedAt).big_integer().not_null())
|
||||||
.col(ColumnDef::new(Consent::ExpiresAt).big_integer())
|
.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(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
||||||
32
src/web.rs
32
src/web.rs
|
|
@ -845,8 +845,11 @@ async fn consent_page(
|
||||||
urlencoded(&q.code_challenge_method.as_ref().unwrap_or(&String::new())),
|
urlencoded(&q.code_challenge_method.as_ref().unwrap_or(&String::new())),
|
||||||
q.state.as_ref().map(|s| format!("&state={}", urlencoded(s))).unwrap_or_default()
|
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!(
|
||||||
.into_response();
|
"/login?return_to={}",
|
||||||
|
urlencoded(&return_to)
|
||||||
|
))
|
||||||
|
.into_response();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
|
|
@ -911,7 +914,13 @@ async fn consent_page(
|
||||||
// Append query parameters to HTML
|
// Append query parameters to HTML
|
||||||
let query_string = serde_urlencoded::to_string(¶ms).unwrap_or_default();
|
let query_string = serde_urlencoded::to_string(¶ms).unwrap_or_default();
|
||||||
let html_with_params = if html.contains("</body>") {
|
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 {
|
} else {
|
||||||
html
|
html
|
||||||
};
|
};
|
||||||
|
|
@ -923,13 +932,11 @@ async fn consent_page(
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_response()
|
.into_response()
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => Response::builder()
|
||||||
Response::builder()
|
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
||||||
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
.body(Body::from("Consent page not found"))
|
||||||
.body(Body::from("Consent page not found"))
|
.unwrap()
|
||||||
.unwrap()
|
.into_response(),
|
||||||
.into_response()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1019,7 +1026,10 @@ async fn consent_submit(
|
||||||
|
|
||||||
let authorize_url = url_append_query(
|
let authorize_url = url_append_query(
|
||||||
"/authorize".to_string(),
|
"/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();
|
return Redirect::temporary(&authorize_url).into_response();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue