commit aa6f774f6518c3caa623ecb9a2f739c649f7b7d1
parent 379f885354cf5cec58fd730e4c2738b46ec8474a
Author: Nikolay Nikolaev <nikolaevn.home@gmail.com>
Date: Fri, 31 Mar 2023 14:03:37 +0300
add check user state
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git 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/<uuid>/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 {