mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 21:18:13 -05:00
[Reset Password] Email template (#1353)
This commit is contained in:
parent
d7f3507d44
commit
c56dd04096
@ -0,0 +1,9 @@
|
|||||||
|
{{#>FullHtmlLayout}}
|
||||||
|
<table width="100%" cellpadding="0" cellspacing="0" style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
|
||||||
|
<tr style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
|
||||||
|
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; margin: 0; -webkit-font-smoothing: antialiased; padding: 0 0 10px; -webkit-text-size-adjust: none;" valign="top">
|
||||||
|
The master password for <b style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">{{UserName}}</b> has been changed by an administrator in your <b style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">{{OrgName}}</b> organization. If you did not initiate this request, please reach out to your administrator immediately.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{{/FullHtmlLayout}}
|
@ -0,0 +1,3 @@
|
|||||||
|
{{#>BasicTextLayout}}
|
||||||
|
The master password for {{UserName}} has been changed by an administrator in your {{OrgName}} organization. If you did not initiate this request, please reach out to your administrator immediately.
|
||||||
|
{{/BasicTextLayout}}
|
8
src/Core/Models/Mail/AdminResetPasswordViewModel.cs
Normal file
8
src/Core/Models/Mail/AdminResetPasswordViewModel.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Bit.Core.Models.Mail
|
||||||
|
{
|
||||||
|
public class AdminResetPasswordViewModel : BaseMailModel
|
||||||
|
{
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string OrgName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -40,5 +40,6 @@ namespace Bit.Core.Services
|
|||||||
Task SendEmergencyAccessRecoveryReminder(EmergencyAccess emergencyAccess, string initiatingName, string email);
|
Task SendEmergencyAccessRecoveryReminder(EmergencyAccess emergencyAccess, string initiatingName, string email);
|
||||||
Task SendEmergencyAccessRecoveryTimedOut(EmergencyAccess ea, string initiatingName, string email);
|
Task SendEmergencyAccessRecoveryTimedOut(EmergencyAccess ea, string initiatingName, string email);
|
||||||
Task SendEnqueuedMailMessageAsync(IMailQueueMessage queueMessage);
|
Task SendEnqueuedMailMessageAsync(IMailQueueMessage queueMessage);
|
||||||
|
Task SendAdminResetPasswordEmailAsync(string email, string userName, string orgName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,6 +361,19 @@ namespace Bit.Core.Services
|
|||||||
await AddMessageContentAsync(message, queueMessage.TemplateName, queueMessage.Model);
|
await AddMessageContentAsync(message, queueMessage.TemplateName, queueMessage.Model);
|
||||||
await _mailDeliveryService.SendEmailAsync(message);
|
await _mailDeliveryService.SendEmailAsync(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task SendAdminResetPasswordEmailAsync(string email, string userName, string orgName)
|
||||||
|
{
|
||||||
|
var message = CreateDefaultMessage("Master Password Has Been Changed", email);
|
||||||
|
var model = new AdminResetPasswordViewModel()
|
||||||
|
{
|
||||||
|
UserName = CoreHelpers.SanitizeForEmail(userName),
|
||||||
|
OrgName = CoreHelpers.SanitizeForEmail(orgName),
|
||||||
|
};
|
||||||
|
await AddMessageContentAsync(message, "AdminResetPassword", model);
|
||||||
|
message.Category = "AdminResetPassword";
|
||||||
|
await _mailDeliveryService.SendEmailAsync(message);
|
||||||
|
}
|
||||||
|
|
||||||
private Task EnqueueMailAsync(IMailQueueMessage queueMessage) =>
|
private Task EnqueueMailAsync(IMailQueueMessage queueMessage) =>
|
||||||
_mailEnqueuingService.EnqueueAsync(queueMessage, SendEnqueuedMailMessageAsync);
|
_mailEnqueuingService.EnqueueAsync(queueMessage, SendEnqueuedMailMessageAsync);
|
||||||
|
@ -689,7 +689,7 @@ namespace Bit.Core.Services
|
|||||||
user.Key = key;
|
user.Key = key;
|
||||||
|
|
||||||
await _userRepository.ReplaceAsync(user);
|
await _userRepository.ReplaceAsync(user);
|
||||||
// TODO Reset Password - Send email alerting user of changed password
|
await _mailService.SendAdminResetPasswordEmailAsync(user.Email, user.Name ?? user.Email, org.Name);
|
||||||
await _eventService.LogOrganizationUserEventAsync(orgUser, EventType.OrganizationUser_AdminResetPassword);
|
await _eventService.LogOrganizationUserEventAsync(orgUser, EventType.OrganizationUser_AdminResetPassword);
|
||||||
await _pushService.PushLogOutAsync(user.Id);
|
await _pushService.PushLogOutAsync(user.Id);
|
||||||
|
|
||||||
|
@ -158,5 +158,10 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task SendAdminResetPasswordEmailAsync(string email, string userName, string orgName)
|
||||||
|
{
|
||||||
|
return Task.FromResult(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user