diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index caa163a0..7ca0d6d3 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -257,6 +257,7 @@ + @@ -264,6 +265,7 @@ + diff --git a/Logic/Support/General.cs b/Logic/Support/General.cs index 442a0123..14a707b8 100644 --- a/Logic/Support/General.cs +++ b/Logic/Support/General.cs @@ -6,6 +6,7 @@ using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; +using System.Web; namespace Swarmops.Logic.Support { @@ -35,5 +36,23 @@ namespace Swarmops.Logic.Support return result.ToString(); } + public static string GetRemoteIPAddressChain() + { + string forwardedIps = + HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; + + string directIp = + HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; + + string result = directIp; + + if (!string.IsNullOrEmpty(forwardedIps)) + { + result = forwardedIps.Split (',').Last().Trim(); + result += " (" + directIp + ", " + forwardedIps + ")"; + } + + return result; + } } } diff --git a/Logic/Support/LogEntries/PasswordResetRequest.cs b/Logic/Support/LogEntries/PasswordResetRequest.cs new file mode 100644 index 00000000..98efd320 --- /dev/null +++ b/Logic/Support/LogEntries/PasswordResetRequest.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using Swarmops.Logic.Structure; +using Swarmops.Logic.Swarm; + +namespace Swarmops.Logic.Support.LogEntries +{ + [Serializable] + public class PasswordResetRequest: SecurityActionBase + { + public PasswordResetRequest() + { + // empty ctor for serialization + } + + public PasswordResetRequest (Person concernedPerson, string remoteIPAddresses, + Person actingPerson = null, Organization organization = null) + { + this.ConcernedPersonId = concernedPerson.Identity; + this.RemoteIPAddresses = remoteIPAddresses; + this.ActingPersonId = actingPerson != null ? actingPerson.Identity : 0; + this.OrganizationId = organization != null ? organization.Identity : 0; + } + } +} diff --git a/Logic/Support/LogEntries/SecurityActionBase.cs b/Logic/Support/LogEntries/SecurityActionBase.cs new file mode 100644 index 00000000..6fe5f4e8 --- /dev/null +++ b/Logic/Support/LogEntries/SecurityActionBase.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Swarmops.Logic.Support.LogEntries +{ + [Serializable] + public class SecurityActionBase: LogEntryBase + { + public int OrganizationId { get; set; } + public int ActingPersonId { get; set; } + public int ConcernedPersonId { get; set; } + public string RemoteIPAddresses { get; set; } + /// + /// Always in UTC + /// + public DateTime DateTime { get; set; } + } +} diff --git a/Site5/App_GlobalResources/Global.resx b/Site5/App_GlobalResources/Global.resx index b4ec1ded..91f1161c 100644 --- a/Site5/App_GlobalResources/Global.resx +++ b/Site5/App_GlobalResources/Global.resx @@ -553,6 +553,6 @@ Postal Code - There was a general, unspecified error contacting the Swarmops server. Is the still network operational and the server available? + There was a general, unspecified error contacting the Swarmops server. Is the network still operational and the server available? \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Admin.resx b/Site5/App_GlobalResources/Pages.Admin.resx index 964f9a34..12cfe5a8 100644 --- a/Site5/App_GlobalResources/Pages.Admin.resx +++ b/Site5/App_GlobalResources/Pages.Admin.resx @@ -206,6 +206,9 @@ Various technical settings for this Swarmops installation. Not specific to any organization or person, but installation-wide. + + Installation Name + System Settings @@ -215,4 +218,7 @@ Swarmops has sent you a test mail to verify your new SMTP server settings. + + You really, really, REALLY should use HTTPS for a website like this. But you knew that already, didn't you? + \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Security.resx b/Site5/App_GlobalResources/Pages.Security.resx index c959163b..3903b39a 100644 --- a/Site5/App_GlobalResources/Pages.Security.resx +++ b/Site5/App_GlobalResources/Pages.Security.resx @@ -215,10 +215,10 @@ User - Reset password for mail address + Re-enter your mail address - There is no valid password reset ticket for this email address, the address does not exist, the password reset ticket is invalid, or it has expired. Password reset failed. + 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. Password reset failed. You're resetting the password for a user account. Enter your new password twice to set it and login. @@ -226,6 +226,9 @@ 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. + + The two passwords do not match. Please retry. + The new password cannot be empty. @@ -239,7 +242,7 @@ Repeat New Password - You may reset the password associated with an email address. A link with a ticket code will be sent to that email address, which you must follow to reset your password. + You may reset the password associated with an mail address. A link with a ticket code will be sent to that mail address, which you must follow to reset your password. Reset @@ -251,6 +254,6 @@ Ticket - If the email was associated with an account on this Swarmops installation, a <strong>reset ticket has been sent.</strong> Open that mail and click the link in the mail to reset your password. (If the email did not exist, nothing was sent.)<br/><br/>You may close this browser tab. It is not needed anymore. + If the mail address was associated with an account on this Swarmops installation, a <strong>reset ticket has been sent.</strong> Open that mail and click the link in the mail to reset your password. (If the email did not exist, nothing was sent.)<br/><br/>You may close this browser tab. It is not needed anymore. \ No newline at end of file diff --git a/Site5/Controls/v5/Base/AjaxTextBox.ascx b/Site5/Controls/v5/Base/AjaxTextBox.ascx index ab6f3e64..2b868650 100644 --- a/Site5/Controls/v5/Base/AjaxTextBox.ascx +++ b/Site5/Controls/v5/Base/AjaxTextBox.ascx @@ -56,9 +56,17 @@ } $(this).val(_initVal_<%=this.TextInput.ClientID%>); $(this).animate({ backgroundColor: "#FFFFFF" }, 250); + <% + + if (!string.IsNullOrEmpty (this.OnChange)) + { + Response.Write (this.OnChange + "(msg.d.NewData);"); // JavaScript callback on successful change + } + + %> }, this), error: $.proxy(function (msg) { - alertify.error("There was an error calling the server to set the new value. Is the server reachable?"); // TODO: Localize + alertify.error("<%= Resources.Global.Error_AjaxCallException %>"); $(this).val (_initVal_<%=this.TextInput.ClientID%>); $(this).css('background-color', '#FFA0A0'); $(this).animate({ backgroundColor: "#FFFFFF" }, 250); diff --git a/Site5/Controls/v5/Base/AjaxTextBox.ascx.cs b/Site5/Controls/v5/Base/AjaxTextBox.ascx.cs index 7d95323f..108463f1 100644 --- a/Site5/Controls/v5/Base/AjaxTextBox.ascx.cs +++ b/Site5/Controls/v5/Base/AjaxTextBox.ascx.cs @@ -26,6 +26,7 @@ namespace Swarmops.Frontend.Controls.v5.Base } public string Cookie { set; get; } + public string OnChange { get; set; } public string AjaxCallbackUrl { set; get; } public string Placeholder { get; set; } diff --git a/Site5/Pages/v5/Admin/Settings.aspx b/Site5/Pages/v5/Admin/Settings.aspx index f846e44c..77cb5dc6 100644 --- a/Site5/Pages/v5/Admin/Settings.aspx +++ b/Site5/Pages/v5/Admin/Settings.aspx @@ -8,6 +8,14 @@ $(document).ready(function() { $('#divTabs').tabs(); }); + + function onUrlChange(newText) { + // 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 %>"); + } + } + @@ -20,10 +28,12 @@

Correspondence transmission settings

​
- ​
+ ​
+ ​
diff --git a/Site5/Pages/v5/Admin/Settings.aspx.cs b/Site5/Pages/v5/Admin/Settings.aspx.cs index 2ecc98f8..46f7db7d 100644 --- a/Site5/Pages/v5/Admin/Settings.aspx.cs +++ b/Site5/Pages/v5/Admin/Settings.aspx.cs @@ -32,6 +32,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin this.TextSmtpServer.Text = FormatSmtpAccessString(SystemSettings.SmtpUser, SystemSettings.SmtpPassword, SystemSettings.SmtpHost, SystemSettings.SmtpPort); this.TextExternalUrl.Text = SystemSettings.ExternalUrl; + this.TextInstallationName.Text = SystemSettings.InstallationName; Localize(); } @@ -62,6 +63,7 @@ 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; } [WebMethod] @@ -111,8 +113,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin result.ResultCode = AjaxTextBox.CodeInvalid; result.DisplayMessage = Resources.Pages.Admin.SystemSettings_Error_SmtpSyntax; } - break; + case "ExtUrl": if (!newValue.EndsWith("/")) { @@ -128,6 +130,13 @@ namespace Swarmops.Frontend.Pages.v5.Admin result.NewData = newValue; result.ResultCode = AjaxTextBox.CodeSuccess; break; + + case "InstallationName": + result.NewData = newValue.Trim(); + result.ResultCode = AjaxTextBox.CodeSuccess; + SystemSettings.InstallationName = newValue; + break; + default: throw new NotImplementedException("Unknown cookie in StoreCallback"); } diff --git a/Site5/Security/Login.aspx b/Site5/Security/Login.aspx index a23b417a..fe26e498 100644 --- a/Site5/Security/Login.aspx +++ b/Site5/Security/Login.aspx @@ -19,7 +19,8 @@ Swarmops Alpha - Login - + + @@ -199,7 +200,7 @@
-