More work on Reset Password
This commit is contained in:
@@ -257,6 +257,7 @@
|
||||
<Compile Include="Support\IXmlPayload.cs" />
|
||||
<Compile Include="Support\LogEntries\CashAdvanceRequestedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\MembershipActionBase.cs" />
|
||||
<Compile Include="Support\LogEntries\PasswordResetRequest.cs" />
|
||||
<Compile Include="Support\LogEntries\PersonAddedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\SalaryCreatedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\InboundInvoiceCreatedLogEntry.cs" />
|
||||
@@ -264,6 +265,7 @@
|
||||
<Compile Include="Support\LogEntries\FinancialActionBase.cs" />
|
||||
<Compile Include="Support\LogEntries\LogEntryBase.cs" />
|
||||
<Compile Include="Support\LogEntries\PayoutCreatedLogEntry.cs" />
|
||||
<Compile Include="Support\LogEntries\SecurityActionBase.cs" />
|
||||
<Compile Include="Support\ObjectOptionalData.cs" />
|
||||
<Compile Include="Support\PilotInstallationIds.cs" />
|
||||
<Compile Include="Support\PluralBase.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<SecurityActionBase>
|
||||
{
|
||||
public int OrganizationId { get; set; }
|
||||
public int ActingPersonId { get; set; }
|
||||
public int ConcernedPersonId { get; set; }
|
||||
public string RemoteIPAddresses { get; set; }
|
||||
/// <summary>
|
||||
/// Always in UTC
|
||||
/// </summary>
|
||||
public DateTime DateTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -553,6 +553,6 @@
|
||||
<value>Postal Code</value>
|
||||
</data>
|
||||
<data name="Error_AjaxCallException" xml:space="preserve">
|
||||
<value>There was a general, unspecified error contacting the Swarmops server. Is the still network operational and the server available?</value>
|
||||
<value>There was a general, unspecified error contacting the Swarmops server. Is the network still operational and the server available?</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -206,6 +206,9 @@
|
||||
<data name="SystemSettings_Info" xml:space="preserve">
|
||||
<value>Various technical settings for this Swarmops installation. Not specific to any organization or person, but installation-wide.</value>
|
||||
</data>
|
||||
<data name="SystemSettings_InstallationName" xml:space="preserve">
|
||||
<value>Installation Name</value>
|
||||
</data>
|
||||
<data name="SystemSettings_PageTitle" xml:space="preserve">
|
||||
<value>System Settings</value>
|
||||
</data>
|
||||
@@ -215,4 +218,7 @@
|
||||
<data name="SystemSettings_TestMailSent" xml:space="preserve">
|
||||
<value>Swarmops has sent you a test mail to verify your new SMTP server settings.</value>
|
||||
</data>
|
||||
<data name="SystemSettings_Warning_Insecure" xml:space="preserve">
|
||||
<value>You really, really, REALLY should use HTTPS for a website like this. But you knew that already, didn't you?</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -215,10 +215,10 @@
|
||||
<value>User</value>
|
||||
</data>
|
||||
<data name="ResetPassword_Email" xml:space="preserve">
|
||||
<value>Reset password for mail address</value>
|
||||
<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 email address, the address does not exist, the password reset ticket is invalid, or it has expired. Password reset failed.</value>
|
||||
<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. Password reset failed.</value>
|
||||
</data>
|
||||
<data name="ResetPassword_Info" xml:space="preserve">
|
||||
<value>You're resetting the password for a user account. Enter your new password twice to set it and login.</value>
|
||||
@@ -226,6 +226,9 @@
|
||||
<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>
|
||||
</data>
|
||||
<data name="ResetPassword_NewPasswordsDontMatch" xml:space="preserve">
|
||||
<value>The two passwords do not match. Please retry.</value>
|
||||
</data>
|
||||
<data name="ResetPassword_NoEmpty" xml:space="preserve">
|
||||
<value>The new password cannot be empty.</value>
|
||||
</data>
|
||||
@@ -239,7 +242,7 @@
|
||||
<value>Repeat New Password</value>
|
||||
</data>
|
||||
<data name="ResetPassword_RequestInfo" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
<value>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.</value>
|
||||
</data>
|
||||
<data name="ResetPassword_Reset" xml:space="preserve">
|
||||
<value>Reset</value>
|
||||
@@ -251,6 +254,6 @@
|
||||
<value>Ticket</value>
|
||||
</data>
|
||||
<data name="ResetPassword_TicketSentMaybe" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
<value>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.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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 %>");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -20,10 +28,12 @@
|
||||
<h2>Correspondence transmission settings</h2>
|
||||
<div class="entryFields">
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextSmtpServer" Cookie="Smtp" AjaxCallbackUrl="/Pages/v5/Admin/Settings.aspx/StoreCallback" Placeholder="localhost:587" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextExternalUrl" Cookie="ExtUrl" AjaxCallbackUrl="/Pages/v5/Admin/Settings.aspx/StoreCallback" Placeholder="https://swarmops.example.com/" />​<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/>
|
||||
</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 />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
<title>Swarmops Alpha - Login</title>
|
||||
|
||||
<link href="/Style/style-v5.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.core.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.default.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- custom styles -->
|
||||
|
||||
@@ -199,7 +200,7 @@
|
||||
|
||||
<div class="box">
|
||||
<div class="content">
|
||||
<div class="link-row-encaps" onclick=" return false; " >
|
||||
<div class="link-row-encaps" onclick=" document.location='/Security/RequestPasswordReset'; return false; " >
|
||||
<div class="link-row-icon" style="background-image: url('/Images/Icons/iconshock-databaseconnect-16px.png')"></div>
|
||||
<asp:Label ID="LabelSidebarResetPassword" runat="server" />
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
<title>Swarmops Alpha - Request Password Reset</title>
|
||||
|
||||
<link href="/Style/style-v5.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.core.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.default.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- custom styles -->
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Web.UI.WebControls;
|
||||
using Swarmops.Logic.Communications;
|
||||
using Swarmops.Logic.Communications.Transmission;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Support.LogEntries;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
namespace Swarmops.Pages.Security
|
||||
@@ -26,12 +27,14 @@ namespace Swarmops.Pages.Security
|
||||
{
|
||||
Localize();
|
||||
}
|
||||
|
||||
this.TextMailAddress.Focus();
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
{
|
||||
// Normal template
|
||||
this.LabelSidebarInfoContent.Text = Resources.Pages.Security.ResetPassword_Info;
|
||||
this.LabelSidebarInfoContent.Text = Resources.Pages.Security.ResetPassword_InfoRequest;
|
||||
this.LabelSidebarInfoHeader.Text = Resources.Global.Sidebar_Information;
|
||||
this.LabelCurrentOrganizationName.Text = Resources.Global.Global_Organization;
|
||||
this.LabelCurrentUserName.Text = Resources.Global.Global_NoOwner;
|
||||
@@ -69,6 +72,7 @@ namespace Swarmops.Pages.Security
|
||||
|
||||
OutboundComm.CreateSecurityNotification (concernedPerson, null, null, string.Empty,
|
||||
NotificationResource.Password_CannotReset2FA);
|
||||
return true; // still returning true - the fail info is in mail only
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +83,8 @@ namespace Swarmops.Pages.Security
|
||||
OutboundComm.CreateSecurityNotification (concernedPerson, null, null, resetTicket,
|
||||
NotificationResource.Password_ResetOnRequest);
|
||||
|
||||
// Create log entry
|
||||
SwarmopsLog.CreateEntry (null,
|
||||
new PasswordResetRequest (concernedPerson, SupportFunctions.GetRemoteIPAddressChain()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ResetPassword.aspx.cs" Inherits="Swarmops.Pages.Security.ResetPassword" %>
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head id="Head1" runat="server">
|
||||
|
||||
<!-- jQuery and plugins -->
|
||||
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" ></script>
|
||||
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/jquery.json.min.js"></script>
|
||||
|
||||
<!-- fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Permanent+Marker' rel='stylesheet' type='text/css' />
|
||||
<link href='https://fonts.googleapis.com/css?family=Ubuntu:light,regular,500,bold' rel='stylesheet' type='text/css' />
|
||||
<link href='https://fonts.googleapis.com/css?family=Arimo:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css' />
|
||||
|
||||
<!-- page title -->
|
||||
<title>Swarmops Alpha - Password Reset</title>
|
||||
|
||||
<link href="/Style/style-v5.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.core.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.default.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- custom styles -->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form id="form2" runat="server">
|
||||
<asp:ScriptManager runat="server" ID="ScriptManagerBlahblah" />
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
/* document.ready goes here */
|
||||
|
||||
});
|
||||
|
||||
function resetPassword() {
|
||||
var jsonData = {};
|
||||
jsonData.mailAddress = $('#<%=this.TextMailAddress.ClientID%>').val();
|
||||
jsonData.ticket = val();
|
||||
jsonData.newPassword = val();
|
||||
|
||||
if (jsonData.newPassword != val()) {
|
||||
alertify.error("<%= Resources.Pages.Security.ResetPassword_NewPasswordsDontMatch %>");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Security/ResetPassword.aspx/PerformReset",
|
||||
data: $.toJSON(jsonData),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
async: false, // blocks until function returns - race conditions otherwise
|
||||
success: function (msg) {
|
||||
if (msg.d) {
|
||||
$('#DivSuccessMaybe').slideDown();
|
||||
$('#DivMailEntry').slideUp();
|
||||
} else {
|
||||
alertify.alert("<%= Resources.Pages.Security.ResetPassword_Failed %>");
|
||||
}
|
||||
},
|
||||
error: function (msg) {
|
||||
alertify.error("<%=Resources.Global.Error_AjaxCallException%>");
|
||||
}
|
||||
});
|
||||
|
||||
return false; // prevent page submission
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!-- 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="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">
|
||||
<div class="searchbox"><asp:TextBox ID="SearchBox" ReadOnly="true" runat="server" /></div>
|
||||
</div>
|
||||
|
||||
<div class="mainbar">
|
||||
<div class="box">
|
||||
<div class="content">
|
||||
<h2><asp:Label ID="LabelContentTitle" runat="server" /></h2>
|
||||
<div id="DivMailEntry">
|
||||
<div class="entryFields">
|
||||
<asp:TextBox runat="server" ID="TextMailAddress" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextTicket" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextPassword1" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextPassword2" />​<br/>
|
||||
<asp:Button ID="ButtonRequest" runat="server" CssClass="buttonAccentColor NoInputFocus" OnClientClick="return resetPassword();" Text="XYZ Request"/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
<asp:Label ID="LabelMail" runat="server" /><br />
|
||||
<asp:Label ID="LabelTicket" runat="server" /><br />
|
||||
<asp:Label ID="LabelPassword1" runat="server" /><br />
|
||||
<asp:Label ID="LabelPassword2" runat="server" /><br />
|
||||
</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>
|
||||
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<h2 class="blue"><asp:Label ID="LabelSidebarInfoHeader" runat="server" /><span class="arrow"></span></h2>
|
||||
|
||||
<div class="box">
|
||||
<div class="content">
|
||||
<asp:Label ID="LabelSidebarInfoContent" runat="server" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- some javascript in footer -->
|
||||
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/alertify.min.js" ></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
namespace Swarmops.Pages.Security
|
||||
{
|
||||
public partial class ResetPassword : DataV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.Title = Resources.Pages.Security.ResetPassword_PageTitle;
|
||||
this.ImageCultureIndicator.Style[HtmlTextWriterStyle.MarginTop] = "-3px";
|
||||
this.ImageCultureIndicator.Style[HtmlTextWriterStyle.MarginRight] = "3px";
|
||||
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
string suppliedTicket = Request.QueryString["Ticket"];
|
||||
if (!string.IsNullOrEmpty (suppliedTicket) && suppliedTicket.Trim().Length == 32)
|
||||
{
|
||||
this.TextTicket.Text = suppliedTicket.Trim().ToUpperInvariant();
|
||||
this.TextTicket.ReadOnly = true;
|
||||
}
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
this.TextMailAddress.Focus();
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
{
|
||||
// Normal template
|
||||
this.LabelSidebarInfoContent.Text = Resources.Pages.Security.ResetPassword_Info;
|
||||
this.LabelSidebarInfoHeader.Text = Resources.Global.Sidebar_Information;
|
||||
this.LabelCurrentOrganizationName.Text = Resources.Global.Global_Organization;
|
||||
this.LabelCurrentUserName.Text = Resources.Global.Global_NoOwner;
|
||||
this.LabelPreferences.Text = Resources.Global.CurrentUserInfo_Preferences;
|
||||
|
||||
// Page specific
|
||||
this.LabelContentTitle.Text = Resources.Pages.Security.ResetPassword_PageTitle;
|
||||
this.LabelMail.Text = Resources.Pages.Security.ResetPassword_Email;
|
||||
this.LabelPassword1.Text = Resources.Pages.Security.ResetPassword_Password;
|
||||
this.LabelPassword2.Text = Resources.Pages.Security.ResetPassword_PasswordRepeat;
|
||||
this.LabelTicket.Text = Resources.Pages.Security.ResetPassword_Ticket;
|
||||
this.ButtonRequest.Text = Resources.Pages.Security.ResetPassword_Reset;
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static bool PerformReset (string mailAddress, string ticket, string newPassword)
|
||||
{
|
||||
People people = People.FromMail (mailAddress.Trim());
|
||||
if (people.Count != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Person resetPerson = people[0];
|
||||
string[] resetData = resetPerson.ResetPasswordTicket.Split (',');
|
||||
|
||||
if (resetData.Length != 2)
|
||||
{
|
||||
return false; // invalid data
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false; // temp
|
||||
|
||||
// do NOT NOT NOT trim password - this is deliberate. Starting/ending pwds in whitespace must be possible
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user