diff --git a/src/Core/GlobalSettings.cs b/src/Core/GlobalSettings.cs index 762575c3f..d89d8e5f6 100644 --- a/src/Core/GlobalSettings.cs +++ b/src/Core/GlobalSettings.cs @@ -28,6 +28,7 @@ namespace Bit.Core public class BaseServiceUriSettings { public string Vault { get; set; } + public string VaultWithHash => $"{Vault}/#"; public string Api { get; set; } public string Identity { get; set; } public string InternalIdentity { get; set; } diff --git a/src/Core/MailTemplates/Markdown/Welcome.md b/src/Core/MailTemplates/Markdown/Welcome.md index 5d221a4aa..89d72ce2a 100644 --- a/src/Core/MailTemplates/Markdown/Welcome.md +++ b/src/Core/MailTemplates/Markdown/Welcome.md @@ -26,7 +26,7 @@ Desktop Web ============ -You can also access your vault from any web-enabled device using our web vault at: <{{vaultUrl}}> +You can also access your vault from any web-enabled device using our web vault at: <{{vaultUrl}}?utm_source=welcome_email&utm_medium=email> ------------ diff --git a/src/Core/Services/Implementations/MarkdownMailService.cs b/src/Core/Services/Implementations/MarkdownMailService.cs index 12af1755f..d669b71ba 100644 --- a/src/Core/Services/Implementations/MarkdownMailService.cs +++ b/src/Core/Services/Implementations/MarkdownMailService.cs @@ -29,7 +29,7 @@ namespace Bit.Core.Services var model = new Dictionary { ["url"] = string.Format("{0}/verify-email?userId={1}&token={2}", - _globalSettings.BaseServiceUri.Vault, userId, WebUtility.UrlEncode(token)) + _globalSettings.BaseServiceUri.VaultWithHash, userId, WebUtility.UrlEncode(token)) }; var message = await CreateMessageAsync("Verify Your Email", email, "VerifyEmail", model); @@ -42,7 +42,7 @@ namespace Bit.Core.Services var model = new Dictionary { ["url"] = string.Format("{0}/verify-recover-delete?userId={1}&token={2}&email={3}", - _globalSettings.BaseServiceUri.Vault, + _globalSettings.BaseServiceUri.VaultWithHash, userId, WebUtility.UrlEncode(token), WebUtility.UrlEncode(email)), @@ -96,7 +96,7 @@ namespace Bit.Core.Services var model = new Dictionary { ["hint"] = WebUtility.HtmlEncode(hint), - ["vaultUrl"] = _globalSettings.BaseServiceUri.Vault + ["vaultUrl"] = _globalSettings.BaseServiceUri.VaultWithHash }; var message = await CreateMessageAsync("Your Master Password Hint", email, "MasterPasswordHint", model); @@ -146,7 +146,7 @@ namespace Bit.Core.Services ["organizationName"] = WebUtility.HtmlEncode(organizationName), ["url"] = string.Format("{0}/accept-organization?organizationId={1}&organizationUserId={2}" + "&email={3}&organizationName={4}&token={5}", - _globalSettings.BaseServiceUri.Vault, + _globalSettings.BaseServiceUri.VaultWithHash, orgUser.OrganizationId, orgUser.Id, WebUtility.UrlEncode(orgUser.Email), @@ -163,7 +163,7 @@ namespace Bit.Core.Services { var model = new Dictionary { - ["vaultUrl"] = _globalSettings.BaseServiceUri.Vault + ["vaultUrl"] = _globalSettings.BaseServiceUri.VaultWithHash }; var message = await CreateMessageAsync("Welcome", user.Email, "Welcome", model); diff --git a/src/Core/Services/Implementations/RazorMailService.cs b/src/Core/Services/Implementations/RazorMailService.cs index 76136bd0c..fb53bf5d9 100644 --- a/src/Core/Services/Implementations/RazorMailService.cs +++ b/src/Core/Services/Implementations/RazorMailService.cs @@ -37,7 +37,7 @@ namespace Bit.Core.Services { Token = WebUtility.UrlEncode(token), UserId = userId, - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("VerifyEmail", model); @@ -54,7 +54,7 @@ namespace Bit.Core.Services { Token = WebUtility.UrlEncode(token), UserId = userId, - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName, Email = email, EmailEncoded = WebUtility.UrlEncode(email) @@ -73,7 +73,7 @@ namespace Bit.Core.Services { FromEmail = fromEmail, ToEmail = toEmail, - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("ChangeEmailAlreadyExists", model); @@ -87,7 +87,7 @@ namespace Bit.Core.Services var model = new EmailTokenViewModel { Token = token, - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("ChangeEmail", model); @@ -103,7 +103,7 @@ namespace Bit.Core.Services var model = new EmailTokenViewModel { Token = token, - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("TwoFactorEmail", model); @@ -119,7 +119,7 @@ namespace Bit.Core.Services var model = new MasterPasswordHintViewModel { Hint = hint, - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("MasterPasswordHint", model); @@ -132,7 +132,7 @@ namespace Bit.Core.Services var message = CreateDefaultMessage("Your Master Password Hint", email); var model = new BaseMailModel { - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("NoMasterPasswordHint", model); @@ -148,7 +148,7 @@ namespace Bit.Core.Services { OrganizationName = organizationName, UserEmail = userEmail, - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("OrganizationUserAccepted", model); @@ -162,7 +162,7 @@ namespace Bit.Core.Services var model = new OrganizationUserConfirmedViewModel { OrganizationName = organizationName, - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("OrganizationUserConfirmed", model); @@ -181,7 +181,7 @@ namespace Bit.Core.Services OrganizationUserId = orgUser.Id.ToString(), Token = WebUtility.UrlEncode(token), OrganizationNameUrlEncoded = WebUtility.UrlEncode(organizationName), - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("OrganizationUserInvited", model); @@ -194,7 +194,7 @@ namespace Bit.Core.Services var message = CreateDefaultMessage("Welcome", user.Email); var model = new BaseMailModel { - WebVaultUrl = _globalSettings.BaseServiceUri.Vault, + WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName }; message.HtmlContent = _engine.Parse("Welcome", model); diff --git a/src/Core/Services/Implementations/SendGridTemplateMailService.cs b/src/Core/Services/Implementations/SendGridTemplateMailService.cs index 55e864cbf..8266d9bd0 100644 --- a/src/Core/Services/Implementations/SendGridTemplateMailService.cs +++ b/src/Core/Services/Implementations/SendGridTemplateMailService.cs @@ -214,7 +214,7 @@ namespace Bit.Core.Services } AddSubstitution(message, "{{siteName}}", _globalSettings.SiteName); - AddSubstitution(message, "{{baseVaultUri}}", string.Concat(_globalSettings.BaseServiceUri.Vault, "/#")); + AddSubstitution(message, "{{baseVaultUri}}", _globalSettings.BaseServiceUri.VaultWithHash); return message; }