Work on notifications, loc, settings
This commit is contained in:
Generated
+2
-2
@@ -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]";.
|
||||
/// </summary>
|
||||
internal static string Password_ResetByCrew_Body {
|
||||
get {
|
||||
|
||||
+1
-1
@@ -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.</value>
|
||||
</data>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -194,6 +194,12 @@
|
||||
<value>Renewal cost (in {0})</value>
|
||||
<comment>The {0} is the operating currency (USD etc).</comment>
|
||||
</data>
|
||||
<data name="SystemSettings_AdminAddress" xml:space="preserve">
|
||||
<value>Admin Notifications From Address</value>
|
||||
</data>
|
||||
<data name="SystemSettings_AdminSender" xml:space="preserve">
|
||||
<value>Admin Notifications From Name</value>
|
||||
</data>
|
||||
<data name="SystemSettings_Error_SmtpHostPort" xml:space="preserve">
|
||||
<value>SMTP Port must be numeric. Unable to parse host:port.</value>
|
||||
</data>
|
||||
|
||||
@@ -214,9 +214,6 @@
|
||||
<data name="Login_Username" xml:space="preserve">
|
||||
<value>User</value>
|
||||
</data>
|
||||
<data name="ResetPassword_Email" xml:space="preserve">
|
||||
<value>Re-enter your mail address</value>
|
||||
</data>
|
||||
<data name="ResetPassword_Failed" xml:space="preserve">
|
||||
<value>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></value>
|
||||
</data>
|
||||
@@ -224,7 +221,13 @@
|
||||
<value>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>)</value>
|
||||
</data>
|
||||
<data name="ResetPassword_InfoRequest" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
<value>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.</value>
|
||||
</data>
|
||||
<data name="ResetPassword_Mail1" xml:space="preserve">
|
||||
<value>Enter your mail address</value>
|
||||
</data>
|
||||
<data name="ResetPassword_Mail2" xml:space="preserve">
|
||||
<value>Re-enter your mail address</value>
|
||||
</data>
|
||||
<data name="ResetPassword_NewPasswordsDontMatch" xml:space="preserve">
|
||||
<value>The two passwords do not match. Please retry.</value>
|
||||
|
||||
@@ -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 @@
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextSmtpServer" Cookie="Smtp" AjaxCallbackUrl="/Pages/v5/Admin/Settings.aspx/StoreCallback" Placeholder="localhost:587" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextInstallationName" Cookie="InstallationName" AjaxCallbackUrl="/Pages/v5/Admin/Settings.aspx/StoreCallback" Placeholder="localhost:587" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextExternalUrl" Cookie="ExtUrl" OnChange="onUrlChange" AjaxCallbackUrl="/Pages/v5/Admin/Settings.aspx/StoreCallback" Placeholder="https://swarmops.example.com/" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextAdminSender" Cookie="AdminSender" AjaxCallbackUrl="/Pages/v5/Admin/Settings.aspx/StoreCallback" Placeholder="Swarmops Admin" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextAdminAddress" Cookie="AdminAddress" AjaxCallbackUrl="/Pages/v5/Admin/Settings.aspx/StoreCallback" Placeholder="swarmops-admin@example.com" />​<br/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
<asp:Label ID="LabelSmtpServer" runat="server" /><br/>
|
||||
<asp:Label ID="LabelInstallationName" runat="server" /><br/>
|
||||
<asp:Label ID="LabelExternalUrl" runat="server" /><br />
|
||||
<asp:Label ID="LabelAdminSender" runat="server" /><br />
|
||||
<asp:Label ID="LabelAdminAddress" runat="server" /><br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The only override for the Pages/Public, Style, Images, and Security folders is that no authentication is required.
|
||||
-->
|
||||
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
|
||||
<system.web>
|
||||
<authorization>
|
||||
<allow users="*" />
|
||||
</authorization>
|
||||
</system.web>
|
||||
</configuration>
|
||||
@@ -146,7 +146,7 @@
|
||||
<!-- Main menu, emptied out here -->
|
||||
|
||||
<div class="center980px">
|
||||
<div class="currentuserinfo"><div style="background-image: url('/Images/Icons/iconshock-user-16px.png'); background-repeat: no-repeat; padding-left: 16px; float: left"><asp:Label ID="LabelCurrentUserName" runat="server" /> | </div><div style="background-image: url('/Images/Icons/iconshock-workchair-16px.png'); background-repeat: no-repeat; padding-left: 17px; float: left"><asp:Label ID="LabelCurrentOrganizationName" runat="server" /> | </div><div style="background-image: url('/Images/Icons/iconshock-gamepad-16px.png'); background-repeat: no-repeat; padding-left: 20px; float: left"><asp:Label ID="LabelPreferences" runat="server" /> | </div><asp:Image ID="ImageCultureIndicator" runat="server" ImageUrl="~/Images/Flags/uk-24px.png" /></div>
|
||||
<div class="currentuserinfo"><div style="background-image: url('/Images/Icons/iconshock-user-16px.png'); background-repeat: no-repeat; padding-left: 16px; float: left"><asp:Label ID="LabelCurrentUserName" runat="server" /> | </div><div style="background-image: url('/Images/Icons/iconshock-workchair-16px.png'); background-repeat: no-repeat; padding-left: 17px; float: left"><asp:Label ID="LabelCurrentOrganizationName" runat="server" /> | </div><div style="background-image: url('/Images/Icons/iconshock-gamepad-16px.png'); background-repeat: no-repeat; padding-left: 20px; float: left"><asp:Label ID="LabelPreferences" runat="server" /> | </div><a href="/User/SelectLanguage"><asp:Image ID="ImageCultureIndicator" runat="server" ImageUrl="~/Images/Flags/uk-24px.png" /></a></div>
|
||||
<div class="logoimage"><a href="/"><img style="border: none" src="/Security/Images/Swarmops-Logo.png" alt="Swarmops Logo" /></a></div>
|
||||
<div class="break"></div>
|
||||
<div class="topmenu">
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -114,9 +114,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
<div id="DivSuccessMaybe">
|
||||
<asp:Label ID="LabelSuccessMaybe" runat="server" /><br/><br/><!-- some ugly formatting solutions on the one-off pages -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1 +1 @@
|
||||
Red-1
|
||||
Red-2
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user