1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

vault with hash

This commit is contained in:
Kyle Spearrin 2017-08-16 23:44:14 -04:00
parent d2c5fb462c
commit 297b0253e4
5 changed files with 19 additions and 18 deletions

View File

@ -28,6 +28,7 @@ namespace Bit.Core
public class BaseServiceUriSettings public class BaseServiceUriSettings
{ {
public string Vault { get; set; } public string Vault { get; set; }
public string VaultWithHash => $"{Vault}/#";
public string Api { get; set; } public string Api { get; set; }
public string Identity { get; set; } public string Identity { get; set; }
public string InternalIdentity { get; set; } public string InternalIdentity { get; set; }

View File

@ -26,7 +26,7 @@ Desktop
Web 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>
------------ ------------

View File

@ -29,7 +29,7 @@ namespace Bit.Core.Services
var model = new Dictionary<string, string> var model = new Dictionary<string, string>
{ {
["url"] = string.Format("{0}/verify-email?userId={1}&token={2}", ["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); var message = await CreateMessageAsync("Verify Your Email", email, "VerifyEmail", model);
@ -42,7 +42,7 @@ namespace Bit.Core.Services
var model = new Dictionary<string, string> var model = new Dictionary<string, string>
{ {
["url"] = string.Format("{0}/verify-recover-delete?userId={1}&token={2}&email={3}", ["url"] = string.Format("{0}/verify-recover-delete?userId={1}&token={2}&email={3}",
_globalSettings.BaseServiceUri.Vault, _globalSettings.BaseServiceUri.VaultWithHash,
userId, userId,
WebUtility.UrlEncode(token), WebUtility.UrlEncode(token),
WebUtility.UrlEncode(email)), WebUtility.UrlEncode(email)),
@ -96,7 +96,7 @@ namespace Bit.Core.Services
var model = new Dictionary<string, string> var model = new Dictionary<string, string>
{ {
["hint"] = WebUtility.HtmlEncode(hint), ["hint"] = WebUtility.HtmlEncode(hint),
["vaultUrl"] = _globalSettings.BaseServiceUri.Vault ["vaultUrl"] = _globalSettings.BaseServiceUri.VaultWithHash
}; };
var message = await CreateMessageAsync("Your Master Password Hint", email, "MasterPasswordHint", model); var message = await CreateMessageAsync("Your Master Password Hint", email, "MasterPasswordHint", model);
@ -146,7 +146,7 @@ namespace Bit.Core.Services
["organizationName"] = WebUtility.HtmlEncode(organizationName), ["organizationName"] = WebUtility.HtmlEncode(organizationName),
["url"] = string.Format("{0}/accept-organization?organizationId={1}&organizationUserId={2}" + ["url"] = string.Format("{0}/accept-organization?organizationId={1}&organizationUserId={2}" +
"&email={3}&organizationName={4}&token={5}", "&email={3}&organizationName={4}&token={5}",
_globalSettings.BaseServiceUri.Vault, _globalSettings.BaseServiceUri.VaultWithHash,
orgUser.OrganizationId, orgUser.OrganizationId,
orgUser.Id, orgUser.Id,
WebUtility.UrlEncode(orgUser.Email), WebUtility.UrlEncode(orgUser.Email),
@ -163,7 +163,7 @@ namespace Bit.Core.Services
{ {
var model = new Dictionary<string, string> var model = new Dictionary<string, string>
{ {
["vaultUrl"] = _globalSettings.BaseServiceUri.Vault ["vaultUrl"] = _globalSettings.BaseServiceUri.VaultWithHash
}; };
var message = await CreateMessageAsync("Welcome", user.Email, "Welcome", model); var message = await CreateMessageAsync("Welcome", user.Email, "Welcome", model);

View File

@ -37,7 +37,7 @@ namespace Bit.Core.Services
{ {
Token = WebUtility.UrlEncode(token), Token = WebUtility.UrlEncode(token),
UserId = userId, UserId = userId,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("VerifyEmail", model); message.HtmlContent = _engine.Parse("VerifyEmail", model);
@ -54,7 +54,7 @@ namespace Bit.Core.Services
{ {
Token = WebUtility.UrlEncode(token), Token = WebUtility.UrlEncode(token),
UserId = userId, UserId = userId,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName, SiteName = _globalSettings.SiteName,
Email = email, Email = email,
EmailEncoded = WebUtility.UrlEncode(email) EmailEncoded = WebUtility.UrlEncode(email)
@ -73,7 +73,7 @@ namespace Bit.Core.Services
{ {
FromEmail = fromEmail, FromEmail = fromEmail,
ToEmail = toEmail, ToEmail = toEmail,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("ChangeEmailAlreadyExists", model); message.HtmlContent = _engine.Parse("ChangeEmailAlreadyExists", model);
@ -87,7 +87,7 @@ namespace Bit.Core.Services
var model = new EmailTokenViewModel var model = new EmailTokenViewModel
{ {
Token = token, Token = token,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("ChangeEmail", model); message.HtmlContent = _engine.Parse("ChangeEmail", model);
@ -103,7 +103,7 @@ namespace Bit.Core.Services
var model = new EmailTokenViewModel var model = new EmailTokenViewModel
{ {
Token = token, Token = token,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("TwoFactorEmail", model); message.HtmlContent = _engine.Parse("TwoFactorEmail", model);
@ -119,7 +119,7 @@ namespace Bit.Core.Services
var model = new MasterPasswordHintViewModel var model = new MasterPasswordHintViewModel
{ {
Hint = hint, Hint = hint,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("MasterPasswordHint", model); message.HtmlContent = _engine.Parse("MasterPasswordHint", model);
@ -132,7 +132,7 @@ namespace Bit.Core.Services
var message = CreateDefaultMessage("Your Master Password Hint", email); var message = CreateDefaultMessage("Your Master Password Hint", email);
var model = new BaseMailModel var model = new BaseMailModel
{ {
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("NoMasterPasswordHint", model); message.HtmlContent = _engine.Parse("NoMasterPasswordHint", model);
@ -148,7 +148,7 @@ namespace Bit.Core.Services
{ {
OrganizationName = organizationName, OrganizationName = organizationName,
UserEmail = userEmail, UserEmail = userEmail,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("OrganizationUserAccepted", model); message.HtmlContent = _engine.Parse("OrganizationUserAccepted", model);
@ -162,7 +162,7 @@ namespace Bit.Core.Services
var model = new OrganizationUserConfirmedViewModel var model = new OrganizationUserConfirmedViewModel
{ {
OrganizationName = organizationName, OrganizationName = organizationName,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("OrganizationUserConfirmed", model); message.HtmlContent = _engine.Parse("OrganizationUserConfirmed", model);
@ -181,7 +181,7 @@ namespace Bit.Core.Services
OrganizationUserId = orgUser.Id.ToString(), OrganizationUserId = orgUser.Id.ToString(),
Token = WebUtility.UrlEncode(token), Token = WebUtility.UrlEncode(token),
OrganizationNameUrlEncoded = WebUtility.UrlEncode(organizationName), OrganizationNameUrlEncoded = WebUtility.UrlEncode(organizationName),
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("OrganizationUserInvited", model); message.HtmlContent = _engine.Parse("OrganizationUserInvited", model);
@ -194,7 +194,7 @@ namespace Bit.Core.Services
var message = CreateDefaultMessage("Welcome", user.Email); var message = CreateDefaultMessage("Welcome", user.Email);
var model = new BaseMailModel var model = new BaseMailModel
{ {
WebVaultUrl = _globalSettings.BaseServiceUri.Vault, WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
SiteName = _globalSettings.SiteName SiteName = _globalSettings.SiteName
}; };
message.HtmlContent = _engine.Parse("Welcome", model); message.HtmlContent = _engine.Parse("Welcome", model);

View File

@ -214,7 +214,7 @@ namespace Bit.Core.Services
} }
AddSubstitution(message, "{{siteName}}", _globalSettings.SiteName); AddSubstitution(message, "{{siteName}}", _globalSettings.SiteName);
AddSubstitution(message, "{{baseVaultUri}}", string.Concat(_globalSettings.BaseServiceUri.Vault, "/#")); AddSubstitution(message, "{{baseVaultUri}}", _globalSettings.BaseServiceUri.VaultWithHash);
return message; return message;
} }