diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs index 796b3968..128f8bcb 100644 --- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs +++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs @@ -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: /// - ///[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] + ///[ExternalUrl]Security/ResetPassword?Ticket=[TicketCode] /// - ///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]";. + ///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 [rest of string was truncated]";. /// internal static string Password_ResetByCrew_Body { get { diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx index 1bd63635..b469d403 100644 --- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx +++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx @@ -274,7 +274,7 @@ However, if it was you yourself who changed the password just now, and thereby c Please follow this link to reset your password and re-enable any two-factor authentication, if it was previously enabled: -[ExternalUrl]Security/ResetPassword?Ticket=[ResetPasswordTicket] +[ExternalUrl]Security/ResetPassword?Ticket=[TicketCode] 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. diff --git a/Logic/Communications/Transmission/NotificationPayload.cs b/Logic/Communications/Transmission/NotificationPayload.cs index 08835a17..d0bd91fd 100644 --- a/Logic/Communications/Transmission/NotificationPayload.cs +++ b/Logic/Communications/Transmission/NotificationPayload.cs @@ -84,8 +84,8 @@ namespace Swarmops.Logic.Communications.Transmission result[CommRenderPart.Subject] = GetSubject(); result[CommRenderPart.BodyText] = GetBody(); - result[CommRenderPart.SenderName] = "Swarmops Administrative"; - result[CommRenderPart.SenderMail] = "admin@swarmops.com"; + result[CommRenderPart.SenderName] = SystemSettings.AdminNotificationSender; // TODO: Make dependent on an enum + result[CommRenderPart.SenderMail] = SystemSettings.AdminNotificationAddress; return result; } diff --git a/Logic/Support/SystemSettings.cs b/Logic/Support/SystemSettings.cs index 314be7b4..ba14d0af 100644 --- a/Logic/Support/SystemSettings.cs +++ b/Logic/Support/SystemSettings.cs @@ -79,6 +79,20 @@ namespace Swarmops.Logic.Support } } + + static public string AdminNotificationSender + { + get { return GetDefaultedPersistedKey ("AdminMailFrom", "Swarmops Admin"); } + set { Persistence.Key["AdminMailFrom"] = value; } + } + + static public string AdminNotificationAddress + { + get { return GetDefaultedPersistedKey ("AdminMailAddress", "swarmops-admin@example.com"); } + set { Persistence.Key["AdminMailAddress"] = value; } + } + + static public string InstallationId { get { return Persistence.Key["SwarmopsInstallationId"]; } // no setter - intentional diff --git a/Site5/App_GlobalResources/Pages.Admin.resx b/Site5/App_GlobalResources/Pages.Admin.resx index 12cfe5a8..7ff32f53 100644 --- a/Site5/App_GlobalResources/Pages.Admin.resx +++ b/Site5/App_GlobalResources/Pages.Admin.resx @@ -194,6 +194,12 @@ Renewal cost (in {0}) The {0} is the operating currency (USD etc). + + Admin Notifications From Address + + + Admin Notifications From Name + SMTP Port must be numeric. Unable to parse host:port. diff --git a/Site5/App_GlobalResources/Pages.Security.resx b/Site5/App_GlobalResources/Pages.Security.resx index 20cc6255..edb69a75 100644 --- a/Site5/App_GlobalResources/Pages.Security.resx +++ b/Site5/App_GlobalResources/Pages.Security.resx @@ -214,9 +214,6 @@ User - - Re-enter your mail address - There is no valid password reset ticket for this mail address, the address does not exist, the password reset ticket is invalid, or it has expired.<br/><br/><strong>Password reset failed.</strong> @@ -224,7 +221,13 @@ You're resetting the password for a user account. Enter your new password twice to set it and login. (If you're trying to start the password-reset procedure, you need a ticket to do so. <a href="/Security/RequestPasswordReset">Create a ticket.</a>) - Enter your mail account to send instructions to that address on how to proceed with the password reset procedure. It will contain a unique and expiring code that you will need to use to proceed. + Enter your mail address to receive instructions how to proceed with the password reset procedure. The instructions will contain a unique and expiring code that you will need to use to proceed. + + + Enter your mail address + + + Re-enter your mail address The two passwords do not match. Please retry. diff --git a/Site5/Pages/v5/Admin/Settings.aspx b/Site5/Pages/v5/Admin/Settings.aspx index 77cb5dc6..723d5b3c 100644 --- a/Site5/Pages/v5/Admin/Settings.aspx +++ b/Site5/Pages/v5/Admin/Settings.aspx @@ -10,7 +10,10 @@ }); function onUrlChange(newText) { - // Nag an admin who tries to create an unsecure website + // Find domain and reset the admin sender name + // TODO + + // Also, nag an admin who tries to create an unsecure website if (newText.length >= 7 && newText.substring(0,7) == 'http://') { alertify.log("<%=Resources.Pages.Admin.SystemSettings_Warning_Insecure %>"); } @@ -30,11 +33,15 @@ ​
​
​
+ ​
+ ​
diff --git a/Site5/Pages/v5/Admin/Settings.aspx.cs b/Site5/Pages/v5/Admin/Settings.aspx.cs index 46f7db7d..437863fd 100644 --- a/Site5/Pages/v5/Admin/Settings.aspx.cs +++ b/Site5/Pages/v5/Admin/Settings.aspx.cs @@ -64,6 +64,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin this.LabelExternalUrl.Text = Resources.Pages.Admin.SystemSettings_ExternalUrl; this.LabelSmtpServer.Text = Resources.Pages.Admin.SystemSettings_SmtpServer; this.LabelInstallationName.Text = Resources.Pages.Admin.SystemSettings_InstallationName; + this.LabelAdminAddress.Text = Resources.Pages.Admin.SystemSettings_AdminAddress; + this.LabelAdminSender.Text = Resources.Pages.Admin.SystemSettings_AdminSender; } [WebMethod] diff --git a/Site5/Pages/v5/User/SetCulture.aspx.cs b/Site5/Pages/v5/User/SetCulture.aspx.cs index 15df7c94..9085c254 100644 --- a/Site5/Pages/v5/User/SetCulture.aspx.cs +++ b/Site5/Pages/v5/User/SetCulture.aspx.cs @@ -9,17 +9,16 @@ namespace Swarmops.Frontend.Pages.v5.User protected void Page_Load (object sender, EventArgs e) { + string cultureId = Request.QueryString["CultureId"]; + Response.SetCookie(new HttpCookie("PreferredCulture", cultureId)); + AuthenticationData authenticationData = GetAuthenticationDataAndCulture(); - - if (authenticationData.CurrentUser == null) + if (authenticationData.CurrentUser != null) { - throw new UnauthorizedAccessException ("No"); // may cause problems on login screen? + authenticationData.CurrentUser.PreferredCulture = cultureId; } - string cultureId = Request.QueryString["CultureId"]; - Response.SetCookie (new HttpCookie ("PreferredCulture", cultureId)); - authenticationData.CurrentUser.PreferredCulture = cultureId; - Response.Redirect ("/"); // to dashboard + Response.Redirect ("/"); // to dashboard - or maybe back to login page } } } \ No newline at end of file diff --git a/Site5/Pages/v5/User/web.config b/Site5/Pages/v5/User/web.config new file mode 100644 index 00000000..188a433d --- /dev/null +++ b/Site5/Pages/v5/User/web.config @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/Site5/Security/Login.aspx b/Site5/Security/Login.aspx index fe26e498..443f051e 100644 --- a/Site5/Security/Login.aspx +++ b/Site5/Security/Login.aspx @@ -146,7 +146,7 @@
-
|
| 
| 
+
|
| 
| 
Swarmops Logo
diff --git a/Site5/Security/RequestPasswordReset.aspx.cs b/Site5/Security/RequestPasswordReset.aspx.cs index 23bdc55d..ad3febc5 100644 --- a/Site5/Security/RequestPasswordReset.aspx.cs +++ b/Site5/Security/RequestPasswordReset.aspx.cs @@ -42,7 +42,7 @@ namespace Swarmops.Pages.Security // Page specific this.LabelContentTitle.Text = Resources.Pages.Security.ResetPassword_PageTitle; - this.LabelMail.Text = Resources.Pages.Security.ResetPassword_Email; + this.LabelMail.Text = Resources.Pages.Security.ResetPassword_Mail1; this.LabelSuccessMaybe.Text = Resources.Pages.Security.ResetPassword_TicketSentMaybe; this.ButtonRequest.Text = Resources.Pages.Security.ResetPassword_Reset; } @@ -76,7 +76,8 @@ namespace Swarmops.Pages.Security } - string resetTicket = SupportFunctions.GenerateSecureRandomKey (16); // 16 bytes = 128 bits random key, more than good enough + string resetTicket = SupportFunctions.GenerateSecureRandomKey (16); + resetTicket = resetTicket.Substring (0, 21); // We're using a 21-character (84-bit) key mostly for UI consistency with the ticket sent in mail, and it's secure enough concernedPerson.ResetPasswordTicket = DateTime.UtcNow.AddHours (1).ToString(CultureInfo.InvariantCulture) + "," + resetTicket; // Adds expiry - one hour diff --git a/Site5/Security/ResetPassword.aspx b/Site5/Security/ResetPassword.aspx index 7d6591fb..9e55dc8b 100644 --- a/Site5/Security/ResetPassword.aspx +++ b/Site5/Security/ResetPassword.aspx @@ -114,9 +114,6 @@
-
-

-
diff --git a/Site5/Security/ResetPassword.aspx.cs b/Site5/Security/ResetPassword.aspx.cs index f93c21bd..381d965c 100644 --- a/Site5/Security/ResetPassword.aspx.cs +++ b/Site5/Security/ResetPassword.aspx.cs @@ -29,7 +29,7 @@ namespace Swarmops.Pages.Security if (!Page.IsPostBack) { string suppliedTicket = Request.QueryString["Ticket"]; - if (!string.IsNullOrEmpty (suppliedTicket) && suppliedTicket.Trim().Length == 32) + if (!string.IsNullOrEmpty (suppliedTicket) && suppliedTicket.Trim().Length == 21) { this.TextTicket.Text = suppliedTicket.Trim().ToUpperInvariant(); this.TextTicket.ReadOnly = true; @@ -53,7 +53,7 @@ namespace Swarmops.Pages.Security // Page specific this.LabelContentTitle.Text = Resources.Pages.Security.ResetPassword_PageTitle; - this.LabelMail.Text = Resources.Pages.Security.ResetPassword_Email; + this.LabelMail.Text = Resources.Pages.Security.ResetPassword_Mail2; this.LabelPassword1.Text = Resources.Pages.Security.ResetPassword_Password; this.LabelPassword2.Text = Resources.Pages.Security.ResetPassword_PasswordRepeat; this.LabelTicket.Text = Resources.Pages.Security.ResetPassword_Ticket; diff --git a/Site5/SprintName.txt b/Site5/SprintName.txt index 794feb2a..630972af 100644 --- a/Site5/SprintName.txt +++ b/Site5/SprintName.txt @@ -1 +1 @@ -Red-1 +Red-2 diff --git a/Utility/Communications/CommsTransmitterMail.cs b/Utility/Communications/CommsTransmitterMail.cs index b407aaf2..678c4bfe 100644 --- a/Utility/Communications/CommsTransmitterMail.cs +++ b/Utility/Communications/CommsTransmitterMail.cs @@ -1,7 +1,9 @@ using System; +using System.Globalization; using System.Net.Mail; using System.Reflection; using System.Text; +using System.Threading; using Swarmops.Logic.Communications; using Swarmops.Logic.Communications.Transmission; using Swarmops.Logic.Support; @@ -28,6 +30,9 @@ namespace Swarmops.Utility.Communications Type payloadType = assembly.GetType(envelope.PayloadClass); var methodInfo = payloadType.GetMethod("FromXml", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); + // Set culture specific to the person being rendered for + Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture (!string.IsNullOrEmpty (person.PreferredCulture) ? person.PreferredCulture : "en-US"); + ICommsRenderer renderer = (ICommsRenderer)(methodInfo.Invoke(null, new object[] { envelope.PayloadXml })); RenderedComm comm = renderer.RenderComm (person);