mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-07-18 01:49:32 -05:00
[PR #5350] [MERGED] Prevent new users/members to be stored in db when invite fails #31212
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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:
main← Head:defer-member-save-after-mail-sent📝 Commits (2)
391d3fePrevent new users/members when invite failsf4130f7Adjust 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.