add: allow free users to create 2 invites
This commit is contained in:
parent
626c6711ef
commit
2f83497f98
4 changed files with 66 additions and 19 deletions
|
@ -18,7 +18,7 @@ use axum::{
|
|||
};
|
||||
use axum_extra::extract::CookieJar;
|
||||
use serde::Deserialize;
|
||||
use tetratto_core::model::{addr::RemoteAddr, permissions::FinePermission};
|
||||
use tetratto_core::model::addr::RemoteAddr;
|
||||
use tetratto_shared::hash::hash;
|
||||
|
||||
use cf_turnstile::{SiteVerifyRequest, TurnstileClient};
|
||||
|
@ -107,20 +107,20 @@ pub async fn register_request(
|
|||
);
|
||||
}
|
||||
|
||||
let owner = match data.get_user_by_id(invite_code.owner).await {
|
||||
Ok(u) => u,
|
||||
Err(e) => return (None, Json(e.into())),
|
||||
};
|
||||
// let owner = match data.get_user_by_id(invite_code.owner).await {
|
||||
// Ok(u) => u,
|
||||
// Err(e) => return (None, Json(e.into())),
|
||||
// };
|
||||
|
||||
if !owner.permissions.check(FinePermission::SUPPORTER) {
|
||||
return (
|
||||
None,
|
||||
Json(
|
||||
Error::MiscError("Invite code owner must be an active supporter".to_string())
|
||||
.into(),
|
||||
),
|
||||
);
|
||||
}
|
||||
// if !owner.permissions.check(FinePermission::SUPPORTER) {
|
||||
// return (
|
||||
// None,
|
||||
// Json(
|
||||
// Error::MiscError("Invite code owner must be an active supporter".to_string())
|
||||
// .into(),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
user.invite_code = invite_code.id;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue