fix: register page captcha
This commit is contained in:
parent
e5b6b5a4d4
commit
9ba6320d46
3 changed files with 9 additions and 7 deletions
|
@ -130,7 +130,7 @@ async fn main() {
|
||||||
)
|
)
|
||||||
.layer(SetResponseHeaderLayer::if_not_present(
|
.layer(SetResponseHeaderLayer::if_not_present(
|
||||||
HeaderName::from_static("content-security-policy"),
|
HeaderName::from_static("content-security-policy"),
|
||||||
HeaderValue::from_static("default-src 'self' *.spotify.com musicbrainz.org; img-src * data:; media-src *; font-src *; style-src 'unsafe-inline' 'self' *; script-src 'self' 'unsafe-inline' *; object-src 'self' *; upgrade-insecure-requests; connect-src * localhost; frame-src 'self'; frame-ancestors 'self'"),
|
HeaderValue::from_static("default-src 'self' *.spotify.com musicbrainz.org; img-src * data:; media-src *; font-src *; style-src 'unsafe-inline' 'self' *; script-src 'self' 'unsafe-inline' *; object-src 'self' *; upgrade-insecure-requests; connect-src * localhost; frame-src 'self' *.cloudflare.com; frame-ancestors 'self'"),
|
||||||
))
|
))
|
||||||
.layer(CatchPanicLayer::new());
|
.layer(CatchPanicLayer::new());
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,7 @@ pub async fn global_view_request(
|
||||||
Ok((
|
Ok((
|
||||||
[(
|
[(
|
||||||
"content-security-policy",
|
"content-security-policy",
|
||||||
"default-src 'self' *.spotify.com musicbrainz.org; img-src * data:; media-src *; font-src *; style-src 'unsafe-inline' 'self' *; script-src 'self' 'unsafe-inline' *; object-src 'self' *; upgrade-insecure-requests; connect-src * localhost; frame-src 'self'; frame-ancestors *",
|
"default-src 'self' *.spotify.com musicbrainz.org; img-src * data:; media-src *; font-src *; style-src 'unsafe-inline' 'self' *; script-src 'self' 'unsafe-inline' *; object-src 'self' *; upgrade-insecure-requests; connect-src * localhost; frame-src 'self' *.cloudflare.com; frame-ancestors *",
|
||||||
)],
|
)],
|
||||||
Html(data.1.render("journals/app.html", &context).unwrap()),
|
Html(data.1.render("journals/app.html", &context).unwrap()),
|
||||||
))
|
))
|
||||||
|
|
|
@ -103,11 +103,13 @@ impl DataManager {
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
/// * `data` - a mock [`InviteCode`] object to insert
|
/// * `data` - a mock [`InviteCode`] object to insert
|
||||||
pub async fn create_invite_code(&self, data: InviteCode, user: &User) -> Result<InviteCode> {
|
pub async fn create_invite_code(&self, data: InviteCode, user: &User) -> Result<InviteCode> {
|
||||||
// check account creation date
|
// check account creation date (if we aren't a supporter OR this is a purchased account)
|
||||||
if unix_epoch_timestamp() - user.created < Self::MINIMUM_ACCOUNT_AGE_FOR_INVITE_CODES {
|
if !user.permissions.check(FinePermission::SUPPORTER) | user.was_purchased {
|
||||||
return Err(Error::MiscError(
|
if unix_epoch_timestamp() - user.created < Self::MINIMUM_ACCOUNT_AGE_FOR_INVITE_CODES {
|
||||||
"Your account is too young to do this".to_string(),
|
return Err(Error::MiscError(
|
||||||
));
|
"Your account is too young to do this".to_string(),
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue