add: 4 more achievements

This commit is contained in:
trisua 2025-06-29 18:38:32 -04:00
parent 50f4592de2
commit b501a7c5f0
5 changed files with 52 additions and 7 deletions

View file

@ -464,11 +464,20 @@ pub async fn enable_totp_request(
Extension(data): Extension<State>,
) -> impl IntoResponse {
let data = &(data.read().await).0;
let user = match get_user_from_token!(jar, data) {
let mut user = match get_user_from_token!(jar, data) {
Some(ua) => ua,
None => return Json(Error::NotAllowed.into()),
};
// award achievement
if let Err(e) = data
.add_achievement(&mut user, AchievementName::Enable2fa.into())
.await
{
return Json(e.into());
}
// ...
match data.enable_totp(id, user).await {
Ok(x) => Json(ApiReturn {
ok: true,