Adding flag on Greenfield create user call to skip email invitation

This commit is contained in:
rockstardev
2025-05-23 22:50:15 -05:00
parent 4bea616125
commit 49653c3388
2 changed files with 12 additions and 4 deletions

View File

@@ -26,5 +26,10 @@ namespace BTCPayServer.Client.Models
/// Whether this user is an administrator. If left null and there are no admins in the system, the user will be created as an admin. /// Whether this user is an administrator. If left null and there are no admins in the system, the user will be created as an admin.
/// </summary> /// </summary>
public bool? IsAdministrator { get; set; } public bool? IsAdministrator { get; set; }
/// <summary>
/// Flag to specify if email invitation should be sent to the user. https://github.com/btcpayserver/btcpayserver/issues/6406#issuecomment-2886252217
/// </summary>
public bool? SkipEmailInvite { get; set; }
} }
} }

View File

@@ -358,6 +358,9 @@ namespace BTCPayServer.Controllers.Greenfield
Created = DateTimeOffset.UtcNow, Created = DateTimeOffset.UtcNow,
Approved = isAdmin // auto-approve first admin and users created by an admin Approved = isAdmin // auto-approve first admin and users created by an admin
}; };
if (request.SkipEmailInvite == true)
user.RequiresEmailConfirmation = false;
var blob = user.GetBlob() ?? new(); var blob = user.GetBlob() ?? new();
blob.Name = request.Name; blob.Name = request.Name;
blob.ImageUrl = request.ImageUrl; blob.ImageUrl = request.ImageUrl;