[PR #5350] [MERGED] Prevent new users/members to be stored in db when invite fails #21803

Closed
opened 2026-04-30 08:13:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/5350
Author: @BlackDex
Created: 1/5/2025
Status: Merged
Merged: 1/8/2025
Merged by: @dani-garcia

Base: mainHead: defer-member-save-after-mail-sent


📝 Commits (2)

  • 391d3fe Prevent new users/members when invite fails
  • f4130f7 Adjust deleting records

📊 Changes

2 files changed (+100 additions, -68 deletions)

View changed files

📝 src/api/core/organizations.rs (+73 -58)
📝 src/api/core/public.rs (+27 -10)

📄 Description

Currently when a (new) user gets invited as a member to an org, and SMTP is enabled, but sending the invite fails, the user is still created.
They will only not have received a mail, and admins/owners need to re-invite the member again.
Since the dialog window still keeps on-top when this fails, it kinda invites to click try again, but that will fail in mentioning the user is already a member.

To prevent this weird flow, this commit will delete the user, invite and member if sending the mail failed.
This allows the inviter to try again if there was a temporary hiccup for example, or contact the server admin and does not leave stray users/members around.

Fixes #5349


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/5350 **Author:** [@BlackDex](https://github.com/BlackDex) **Created:** 1/5/2025 **Status:** ✅ Merged **Merged:** 1/8/2025 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `defer-member-save-after-mail-sent` --- ### 📝 Commits (2) - [`391d3fe`](https://github.com/dani-garcia/vaultwarden/commit/391d3fe87c5aae6a0aa1df20c1d56bdf9e4a125c) Prevent new users/members when invite fails - [`f4130f7`](https://github.com/dani-garcia/vaultwarden/commit/f4130f7d6a7ce48d92d715b7d158be57398b66c4) Adjust deleting records ### 📊 Changes **2 files changed** (+100 additions, -68 deletions) <details> <summary>View changed files</summary> 📝 `src/api/core/organizations.rs` (+73 -58) 📝 `src/api/core/public.rs` (+27 -10) </details> ### 📄 Description Currently when a (new) user gets invited as a member to an org, and SMTP is enabled, but sending the invite fails, the user is still created. They will only not have received a mail, and admins/owners need to re-invite the member again. Since the dialog window still keeps on-top when this fails, it kinda invites to click try again, but that will fail in mentioning the user is already a member. To prevent this weird flow, this commit will delete the user, invite and member if sending the mail failed. This allows the inviter to try again if there was a temporary hiccup for example, or contact the server admin and does not leave stray users/members around. Fixes #5349 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 08:13:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vaultwarden#21803