fix: register page captcha

This commit is contained in:
trisua 2025-07-05 11:58:51 -04:00
parent e5b6b5a4d4
commit 9ba6320d46
3 changed files with 9 additions and 7 deletions

View file

@ -103,11 +103,13 @@ impl DataManager {
/// # Arguments
/// * `data` - a mock [`InviteCode`] object to insert
pub async fn create_invite_code(&self, data: InviteCode, user: &User) -> Result<InviteCode> {
// check account creation date
if unix_epoch_timestamp() - user.created < Self::MINIMUM_ACCOUNT_AGE_FOR_INVITE_CODES {
return Err(Error::MiscError(
"Your account is too young to do this".to_string(),
));
// check account creation date (if we aren't a supporter OR this is a purchased account)
if !user.permissions.check(FinePermission::SUPPORTER) | user.was_purchased {
if unix_epoch_timestamp() - user.created < Self::MINIMUM_ACCOUNT_AGE_FOR_INVITE_CODES {
return Err(Error::MiscError(
"Your account is too young to do this".to_string(),
));
}
}
// ...