From aa6f774f6518c3caa623ecb9a2f739c649f7b7d1 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolaev Date: Fri, 31 Mar 2023 14:03:37 +0300 Subject: [PATCH] add check user state --- src/api/admin.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/admin.rs b/src/api/admin.rs index 7034274a..0c56d0fa 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -439,6 +439,11 @@ async fn remove_2fa(uuid: String, _token: AdminToken, mut conn: DbConn) -> Empty #[post("/users//invite/resend")] async fn resend_user_invite(uuid: String, _token: AdminToken, mut conn: DbConn) -> EmptyResult { if let Some(user) = User::find_by_uuid(&uuid, &mut conn).await { + //TODO: replace this with user.status check when it will be available (PR#3397) + if !user.password_hash.is_empty() { + err_code!("User already accepted invitation", Status::BadRequest.code); + } + if CONFIG.mail_enabled() { mail::send_invite(&user.email, &user.uuid, None, None, &CONFIG.invitation_org_name(), None).await } else {