diff --git a/Logic/Communications/OutboundComm.cs b/Logic/Communications/OutboundComm.cs index 8efb1dc4..72c87282 100644 --- a/Logic/Communications/OutboundComm.cs +++ b/Logic/Communications/OutboundComm.cs @@ -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); } diff --git a/Site5/Security/RequestPasswordReset.aspx.cs b/Site5/Security/RequestPasswordReset.aspx.cs index cf82ed20..c869c9d9 100644 --- a/Site5/Security/RequestPasswordReset.aspx.cs +++ b/Site5/Security/RequestPasswordReset.aspx.cs @@ -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