fix: invite codes fix: missing icons
This commit is contained in:
parent
5fbf454b52
commit
66beef6b1d
8 changed files with 38 additions and 25 deletions
|
@ -123,10 +123,6 @@ pub async fn register_request(
|
|||
// }
|
||||
|
||||
user.invite_code = invite_code.id;
|
||||
|
||||
if let Err(e) = data.update_invite_code_is_used(invite_code.id, true).await {
|
||||
return (None, Json(e.into()));
|
||||
}
|
||||
}
|
||||
|
||||
// push initial token
|
||||
|
@ -135,21 +131,36 @@ pub async fn register_request(
|
|||
|
||||
// return
|
||||
match data.create_user(user).await {
|
||||
Ok(_) => (
|
||||
Some([(
|
||||
"Set-Cookie",
|
||||
format!(
|
||||
"__Secure-atto-token={}; SameSite=Lax; Secure; Path=/; HostOnly=true; HttpOnly=true; Max-Age={}",
|
||||
initial_token,
|
||||
60 * 60 * 24 * 365
|
||||
),
|
||||
)]),
|
||||
Json(ApiReturn {
|
||||
ok: true,
|
||||
message: initial_token,
|
||||
payload: (),
|
||||
}),
|
||||
),
|
||||
Ok(_) => {
|
||||
// mark invite as used
|
||||
if data.0.0.security.enable_invite_codes {
|
||||
let invite_code = match data.get_invite_code_by_code(&props.invite_code).await {
|
||||
Ok(c) => c,
|
||||
Err(e) => return (None, Json(e.into())),
|
||||
};
|
||||
|
||||
if let Err(e) = data.update_invite_code_is_used(invite_code.id, true).await {
|
||||
return (None, Json(e.into()));
|
||||
}
|
||||
}
|
||||
|
||||
// ...
|
||||
(
|
||||
Some([(
|
||||
"Set-Cookie",
|
||||
format!(
|
||||
"__Secure-atto-token={}; SameSite=Lax; Secure; Path=/; HostOnly=true; HttpOnly=true; Max-Age={}",
|
||||
initial_token,
|
||||
60 * 60 * 24 * 365
|
||||
),
|
||||
)]),
|
||||
Json(ApiReturn {
|
||||
ok: true,
|
||||
message: initial_token,
|
||||
payload: (),
|
||||
}),
|
||||
)
|
||||
}
|
||||
Err(e) => (None, Json(e.into())),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue