diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs index 41444d67..d97e9ac8 100644 --- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs +++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs @@ -122,7 +122,7 @@ namespace Swarmops.Logic.App_GlobalResources { /// /// Looks up a localized string similar to [ConcernedPersonName] has requested a cash advance of [CurrencyCode] [BudgetAmountFloat] for the purpose of [RequestPurpose]. This money is part of your budget, [BudgetName]. /// - ///Please log on to Swarmops at [SystemUrl] to attest or deny.. + ///Please log on to Swarmops at [ExternalUrl] to attest or deny.. /// internal static string CashAdvance_Requested_Body { get { @@ -160,7 +160,7 @@ namespace Swarmops.Logic.App_GlobalResources { /// /// Looks up a localized string similar to [ConcernedPersonName] has created an expense claim against the budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. The claim concerns [RequestPurpose]. You will need to attest this expense claim. /// - ///Please log on to Swarmops at [SystemUrl] to attest or deny.. + ///Please log on to Swarmops at [ExternalUrl] to attest or deny.. /// internal static string ExpenseClaim_Created_Body { get { @@ -278,7 +278,7 @@ namespace Swarmops.Logic.App_GlobalResources { /// /// Looks up a localized string similar to An invoice from [Supplier], concerning [Description], has been filed against your budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. You must attest this invoice before it proceeds to payout. /// - ///Please log on to Swarmops at [SystemUrl] to attest or deny.. + ///Please log on to Swarmops at [ExternalUrl] to attest or deny.. /// internal static string InboundInvoice_Created_Body { get { @@ -405,9 +405,9 @@ namespace Swarmops.Logic.App_GlobalResources { /// ///If you did not just perform this password change, there has been a security breach. If this is the case, please block your account IMMEDIATELY by clicking the following link: /// - ///[SystemUrl]Security/LockoutAccount?Email=[EmailAddress]&Ticket=[LockoutTicket] + ///[ExternalUrl]Security/LockoutAccount?Email=[EmailAddress]&Ticket=[LockoutTicket] /// - ///For security purposes, there will not be a confirmation dialog: your account will be locked the instant you go to this link, and administrators will contact you to verify what happened and work with y [rest of string was truncated]";. + ///For security purposes, there will not be a confirmation dialog: your account will be locked the instant you go to this link, and administrators will contact you to verify what happened and work with [rest of string was truncated]";. /// internal static string Password_Changed_Body { get { @@ -429,9 +429,9 @@ namespace Swarmops.Logic.App_GlobalResources { /// ///Please follow this link to reset your password and re-enable any two-factor authentication, if it was previously enabled: /// - ///[SystemUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] + ///[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] /// - ///This ticket will expire in 24 hours. If you do not reset your password in this time frame, you will need to contact the administrators at [OrganizationName] to issu [rest of string was truncated]";. + ///This ticket will expire in 24 hours. If you do not reset your password in this time frame, you will need to contact the administrators at [OrganizationName] to is [rest of string was truncated]";. /// internal static string Password_ResetByCrew_Body { get { @@ -451,9 +451,9 @@ namespace Swarmops.Logic.App_GlobalResources { /// /// Looks up a localized string similar to Somebody, most likely you, requested a reset of the password associated with this email address at [OrganizationName]. If this was you, please follow the link below in the next 60 minutes to complete the password reset procedure: /// - ///[SystemUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] + ///[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] /// - ///If you did NOT request a password reset, you can (and should) ignore this mail. The password reset request will expire in one hour. (If you are getting a large number of these password reset links that you did not [rest of string was truncated]";. + ///If you did NOT request a password reset, you can (and should) ignore this mail. The password reset request will expire in one hour. (If you are getting a large number of these password reset links that you did n [rest of string was truncated]";. /// internal static string Password_ResetOnRequest_Body { get { @@ -473,7 +473,7 @@ namespace Swarmops.Logic.App_GlobalResources { /// /// Looks up a localized string similar to Receipts have been filed that need validation for their financial processes to continue. /// - ///Please log on to Swarmops at [SystemUrl] to confirm or reject them.. + ///Please log on to Swarmops at [ExternalUrl] to confirm or reject them.. /// internal static string Receipts_Filed_Body { get { diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx index 89881dcf..ee07e25f 100644 --- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx +++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx @@ -142,7 +142,7 @@ This means you should see the amount on your account shortly. [ConcernedPersonName] has requested a cash advance of [CurrencyCode] [BudgetAmountFloat] for the purpose of [RequestPurpose]. This money is part of your budget, [BudgetName]. -Please log on to Swarmops at [SystemUrl] to attest or deny. +Please log on to Swarmops at [ExternalUrl] to attest or deny. This is sent to the budget owner(s) only. @@ -158,7 +158,7 @@ Please log on to Swarmops at [SystemUrl] to attest or deny. [ConcernedPersonName] has created an expense claim against the budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. The claim concerns [RequestPurpose]. You will need to attest this expense claim. -Please log on to Swarmops at [SystemUrl] to attest or deny. +Please log on to Swarmops at [ExternalUrl] to attest or deny. This is sent to the budget owner(s)only. @@ -209,7 +209,7 @@ The claim will be paid out to you when the amount has also been attested by the An invoice from [Supplier], concerning [Description], has been filed against your budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. You must attest this invoice before it proceeds to payout. -Please log on to Swarmops at [SystemUrl] to attest or deny. +Please log on to Swarmops at [ExternalUrl] to attest or deny. [[OrganizationName] - ACTION ITEM] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed @@ -258,7 +258,7 @@ Thank you for your understanding. If you did not just perform this password change, there has been a security breach. If this is the case, please block your account IMMEDIATELY by clicking the following link: -[SystemUrl]Security/LockoutAccount?Email=[EmailAddress]&Ticket=[LockoutTicket] +[ExternalUrl]Security/LockoutAccount?Email=[EmailAddress]&Ticket=[LockoutTicket] For security purposes, there will not be a confirmation dialog: your account will be locked the instant you go to this link, and administrators will contact you to verify what happened and work with you to re-enable your account. @@ -272,7 +272,7 @@ However, if it was you yourself who changed the password, and thereby caused thi Please follow this link to reset your password and re-enable any two-factor authentication, if it was previously enabled: -[SystemUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] +[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] This ticket will expire in 24 hours. If you do not reset your password in this time frame, you will need to contact the administrators at [OrganizationName] to issue a new password reset ticket. @@ -282,7 +282,7 @@ This ticket will expire in 24 hours. If you do not reset your password in this t Somebody, most likely you, requested a reset of the password associated with this email address at [OrganizationName]. If this was you, please follow the link below in the next 60 minutes to complete the password reset procedure: -[SystemUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] +[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] If you did NOT request a password reset, you can (and should) ignore this mail. The password reset request will expire in one hour. (If you are getting a large number of these password reset links that you did not request, please notify the administrator.) @@ -292,7 +292,7 @@ If you did NOT request a password reset, you can (and should) ignore this mail. Receipts have been filed that need validation for their financial processes to continue. -Please log on to Swarmops at [SystemUrl] to confirm or reject them. +Please log on to Swarmops at [ExternalUrl] to confirm or reject them. [[OrganizationName] - ACTION ITEM] Receipts Filed - Validation Needed diff --git a/Logic/Communications/Transmission/NotificationPayload.cs b/Logic/Communications/Transmission/NotificationPayload.cs index 52e38e62..8500de9a 100644 --- a/Logic/Communications/Transmission/NotificationPayload.cs +++ b/Logic/Communications/Transmission/NotificationPayload.cs @@ -61,6 +61,7 @@ namespace Swarmops.Logic.Communications.Transmission input = input.Replace ("[HostName]", Dns.GetHostName()); input = input.Replace ("[DbVersion]", SwarmDb.DbVersionExpected.ToString(CultureInfo.InvariantCulture)); input = input.Replace ("[SwarmopsVersion]", Formatting.SwarmopsVersion); + input = input.Replace ("[ExternalUrl]", SystemSettings.ExternalUrl); // Loop through supplied strings and replace them in the resource. Not very efficient but who cares diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 038a2df7..caa163a0 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -306,6 +306,7 @@ + @@ -402,6 +403,7 @@ ResXFileCodeGenerator Logic.Communications.Transmission.NotificationPayload.Designer.cs + Designer @@ -422,6 +424,7 @@ ResXFileCodeGenerator Logic.Communications.Transmission.MailPayload.Designer.cs + Designer diff --git a/Logic/Support/SystemSettings.cs b/Logic/Support/SystemSettings.cs new file mode 100644 index 00000000..cd2f0f6e --- /dev/null +++ b/Logic/Support/SystemSettings.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// This class is just for readability of other code. Doesn't add any logic at all, really - just readability, like SystemSettings.SmtpHost instead of Persistence.blahblah. + +namespace Swarmops.Logic.Support +{ + public class SystemSettings + { + static public string SmtpHost + { + get + { + return GetDefaultedPersistedKey("SmtpHost", "localhost"); + } + set + { + Persistence.Key["SmtpHost"] = value; + } + } + + static public int SmtpPort + { + get + { + string smtpPortString = Persistence.Key["SmtpPort"]; + int smtpPort = 25; + + if (!string.IsNullOrEmpty(smtpPortString)) + { + smtpPort = Int32.Parse(smtpPortString); // bad place to get out of if this throws + } + + return smtpPort; + } + set + { + Persistence.Key["SmtpPort"] = value.ToString(CultureInfo.InvariantCulture); + } + } + + static public string SmtpUser + { + get + { + return Persistence.Key["SmtpUser"]; + } + set + { + Persistence.Key["SmtpUser"] = value; + } + } + + static public string SmtpPassword + { + get + { + return Persistence.Key["SmtpPassword"]; + } + set + { + Persistence.Key["SmtpPassword"] = value; + } + } + + static public string ExternalUrl + { + get + { + return Persistence.Key["ExternalUrl"]; + } + set + { + Persistence.Key["ExternalUrl"] = value; + } + } + + static private string GetDefaultedPersistedKey (string key, string defaultValue) + { + string result = Persistence.Key[key]; + if (string.IsNullOrEmpty(result)) + { + return defaultValue; + } + return result; + } + } +}