mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
org user invite emails
This commit is contained in:
parent
4eac3694a3
commit
072fb727a8
@ -1,5 +1,5 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseVaultUri": "https://vault.bitwarden.com"
|
||||
}
|
||||
"globalSettings": {
|
||||
"baseVaultUri": "https://vault.bitwarden.com/#"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseVaultUri": "https://vault.bitwarden.com"
|
||||
}
|
||||
"globalSettings": {
|
||||
"baseVaultUri": "https://vault.bitwarden.com/#"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"siteName": "bitwarden",
|
||||
"baseVaultUri": "http://localhost:4001",
|
||||
"baseVaultUri": "http://localhost:4001/#",
|
||||
"jwtSigningKey": "THIS IS A SECRET. IT KEEPS YOUR TOKEN SAFE. :)",
|
||||
"sqlServer": {
|
||||
"connectionString": "SECRET"
|
||||
|
@ -10,6 +10,6 @@ namespace Bit.Core.Services
|
||||
Task SendChangeEmailEmailAsync(string newEmailAddress, string token);
|
||||
Task SendNoMasterPasswordHintEmailAsync(string email);
|
||||
Task SendMasterPasswordHintEmailAsync(string email, string hint);
|
||||
Task SendOrganizationInviteEmailAsync(string organizationName, string email, string token);
|
||||
Task SendOrganizationInviteEmailAsync(string organizationName, OrganizationUser orgUser, string token);
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ namespace Bit.Core.Services
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task SendOrganizationInviteEmailAsync(string organizationName, string email, string token)
|
||||
public Task SendOrganizationInviteEmailAsync(string organizationName, OrganizationUser orgUser, string token)
|
||||
{
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ namespace Bit.Core.Services
|
||||
var nowMillis = CoreHelpers.ToEpocMilliseconds(DateTime.UtcNow);
|
||||
var token = _dataProtector.Protect(
|
||||
$"OrganizationUserInvite {orgUser.Id} {orgUser.Email} {nowMillis}");
|
||||
await _mailService.SendOrganizationInviteEmailAsync("Organization Name", orgUser.Email, token);
|
||||
await _mailService.SendOrganizationInviteEmailAsync("Organization Name", orgUser, token);
|
||||
}
|
||||
|
||||
public async Task<OrganizationUser> AcceptUserAsync(Guid organizationUserId, User user, string token)
|
||||
@ -189,7 +189,7 @@ namespace Bit.Core.Services
|
||||
}
|
||||
|
||||
orgUser.Status = Enums.OrganizationUserStatusType.Accepted;
|
||||
orgUser.UserId = orgUser.Id;
|
||||
orgUser.UserId = user.Id;
|
||||
orgUser.Email = null;
|
||||
await _organizationUserRepository.ReplaceAsync(orgUser);
|
||||
|
||||
|
@ -88,13 +88,15 @@ namespace Bit.Core.Services
|
||||
await _client.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendOrganizationInviteEmailAsync(string organizationName, string email, string token)
|
||||
public async Task SendOrganizationInviteEmailAsync(string organizationName, OrganizationUser orgUser, string token)
|
||||
{
|
||||
var message = CreateDefaultMessage(OrganizationInviteTemplateId);
|
||||
|
||||
message.Subject = $"Join {organizationName}";
|
||||
message.AddTo(new EmailAddress(email));
|
||||
message.AddTo(new EmailAddress(orgUser.Email));
|
||||
message.AddSubstitution("{{organizationName}}", organizationName);
|
||||
message.AddSubstitution("{{organizationId}}", orgUser.OrganizationId.ToString());
|
||||
message.AddSubstitution("{{organizationUserId}}", orgUser.Id.ToString());
|
||||
message.AddSubstitution("{{token}}", token);
|
||||
message.AddCategories(new List<string> { AdministrativeCategoryName, "Organization Invite" });
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user