Misc work on Reset Password

This commit is contained in:
Rick Falkvinge
2015-01-29 12:17:03 +01:00
parent ef154b74a7
commit b190a1b0e9
2 changed files with 33 additions and 5 deletions
+26 -4
View File
@@ -246,14 +246,36 @@ namespace Swarmops.Logic.Communications
}
public static OutboundComm CreateSecurityNotifcation (Person concernedPerson, Person actingPerson, string ticket,
private static OutboundComm CreateSingleRecipientNotification (NotificationPayload payload,
Organization organization, Person addressee)
{
OutboundComm comm = OutboundComm.Create(null, null, organization, CommResolverClass.Unknown, null,
CommTransmitterClass.CommsTransmitterMail, new PayloadEnvelope(payload).ToXml(),
OutboundCommPriority.Low);
comm.AddRecipient(addressee);
comm.Resolved = true;
return comm;
}
public static OutboundComm CreateSecurityNotifcation (Person concernedPerson, Person actingPerson, Organization organization, string ticket,
NotificationResource notification)
{
NotificationPayload payload = new NotificationPayload(notification.ToString());
payload.Strings[NotificationString.ActingPersonName] = actingPerson.Name;
payload.Strings[NotificationString.ConcernedPersonName] = actingPerson.Name;
payload.Strings[NotificationString.]
payload.Strings[NotificationString.ActingPersonName] =
actingPerson != null
? actingPerson.Name
: string.Empty;
payload.Strings[NotificationString.ConcernedPersonName] = concernedPerson.Name;
payload.Strings[NotificationString.MailAddress] = concernedPerson.Mail;
payload.Strings[NotificationString.TicketCode] = ticket;
if (organization != null)
{
payload.Strings[NotificationString.OrganizationName] = organization.Name;
}
return CreateSingleRecipientNotification (payload, organization, concernedPerson);
}
+7 -1
View File
@@ -6,6 +6,7 @@ using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using Swarmops.Logic.Support;
using Swarmops.Logic.Swarm;
namespace Swarmops.Pages.Security
{
@@ -49,9 +50,14 @@ namespace Swarmops.Pages.Security
return false; // this is the only case when we return false: a _syntactically_invalid_ address
}
People concernedPeople = People.FromEmail (mailAddress); // Should result in exactly 1
string resetTicket = SupportFunctions.GenerateSecureRandomKey (16); // 16 bytes = 128 bits random key, more than good enough
// Create notification
Outbound
// Create log entry