mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-10 22:52:50 +02:00
web::login: add form-data CSP rules for localhost
This commit is contained in:
parent
50c6f32ce8
commit
a536bc4c97
1 changed files with 5 additions and 3 deletions
|
@ -24,10 +24,12 @@ pub struct OidcResponse {
|
||||||
|
|
||||||
impl IntoResponse for OidcResponse {
|
impl IntoResponse for OidcResponse {
|
||||||
fn into_response(self) -> Response<Body> {
|
fn into_response(self) -> Response<Body> {
|
||||||
let content_csp = match self.nonce {
|
let csp_src = match self.nonce {
|
||||||
| Some(nonce) => &format!("default-src 'nonce-{nonce}'; form-action 'self';"),
|
| Some(nonce) => &format!("default-src 'nonce-{nonce}';"),
|
||||||
| None => "default-src 'none'; form-action 'self';",
|
| None => "default-src 'none';",
|
||||||
};
|
};
|
||||||
|
let csp_form_action = "form-action 'self' http://localhost http://127.0.0.1 http://[::1];";
|
||||||
|
let content_csp = format!("{csp_src} {csp_form_action}");
|
||||||
let content_type = match self.body {
|
let content_type = match self.body {
|
||||||
| Some(OAuthRequestBody::Json(_)) => "application/json",
|
| Some(OAuthRequestBody::Json(_)) => "application/json",
|
||||||
| _ => "text/html",
|
| _ => "text/html",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue