aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin.rs
diff options
context:
space:
mode:
authorNikolay Nikolaev <[email protected]>2023-03-30 15:23:16 +0300
committerNikolay Nikolaev <[email protected]>2023-03-30 15:23:16 +0300
commitdcaaa430f046a3c65b5c278d5c7f23b1092fe33e (patch)
treec6ce23a43066fd9ab5b1ecb91d1f3b30d50e7e06 /src/api/admin.rs
parent525e6bb65a6926e0f9de3fc5dafd5c5b63981f9f (diff)
downloadvaultwarden-dcaaa430f046a3c65b5c278d5c7f23b1092fe33e.tar.gz
vaultwarden-dcaaa430f046a3c65b5c278d5c7f23b1092fe33e.zip
support `/users/<uuid>/invite/resend` admin api
Diffstat (limited to 'src/api/admin.rs')
-rw-r--r--src/api/admin.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/api/admin.rs b/src/api/admin.rs
index 0fd7c2cf..9c3be7d8 100644
--- a/src/api/admin.rs
+++ b/src/api/admin.rs
@@ -53,7 +53,8 @@ pub fn routes() -> Vec<Route> {
organizations_overview,
delete_organization,
diagnostics,
- get_diagnostics_config
+ get_diagnostics_config,
+ resend_user_invite,
]
}
@@ -435,6 +436,19 @@ async fn remove_2fa(uuid: String, _token: AdminToken, mut conn: DbConn) -> Empty
user.save(&mut conn).await
}
+#[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 {
+ if CONFIG.mail_enabled() {
+ mail::send_invite(&user.email, &user.uuid, None, None, &CONFIG.invitation_org_name(), None).await
+ } else {
+ Ok(())
+ }
+ } else {
+ err_code!("User doesn't exist", Status::NotFound.code);
+ }
+}
+
#[derive(Deserialize, Debug)]
struct UserOrgTypeData {
user_type: NumberOrString,