Exemple #1
0
 private Task <Email> GenerateRejection(S4Response s4, Email email)
 {
     email.subject = $@"Your request for a ***** account has been rejected";
     email.body    = $@"
         <div>Dear {s4.request.first_name},<br><br>
             Your request for a ***** account has been denied.<br><br>
             The reason given: {s4.message}<br><br>
             If you believe there has been an error please ****** <br><br>
             Respectfully<br>
         </div>";
     return(Task.FromResult(email));
 }
Exemple #2
0
        private Task <List <string> > AddChainOfCommand(S4Response s4, List <string> cc)
        {
            var _query  = $@"TODO";
            var _params = new {};

            using (var conn = new NpgsqlConnection(_conn))
            {
                var primaryAccounts = conn.Query <string>(_query, _params);
                cc.AddRange(primaryAccounts);
                return(Task.FromResult(cc));
            }
        }
Exemple #3
0
 private Task <string> AddPrimaryApproval(S4Response s4, Email email)
 {
     return(Task.FromResult(
                $@"<div>   
             You are registered as the primary account holder for {s4.request.organization}. Bestowed upon you is the ability to: <br>
             <ul>
                 <li>verify account requests under your agency</li>
                 <li>create accounts under your agency</li>
                 <li>delete accounts under your agency</li>
                 <li>view agency statistics dashboard</li>
                 <li>approve/revoke or transfer primary account status</li>
                 <li>update/delete your agency</li>
             </ul>
         </div>"));
 }
Exemple #4
0
        private Task <string> AddActivationLink(S4Response s4, Email email)
        {
            var s4id = s4.request.request_number;
            var link = $@"http://*****:*****@"<div>   
                    Follow the link to activate your account and set your password: <br><br>
                    <a href={link}>Click to complete registration</a><br>
                    <br>
                    Thanks for yadda bo badda, <br>
                    <br>
                    Your Mom<br>
                </div>"));
        }
Exemple #5
0
        public async Task <StandardResponse> initSendEmail(StandardResponse res, S4Response s4)
        {
            var email = new Email();
            var cc    = new List <string>();

            email.recipient = s4.request.email;
            // first add primaries to email chain if applicable
            if (s4.request_type == RequestType.Member || s4.request_type == RequestType.Admin)
            {
                cc = await AddChainOfCommand(s4, cc);
            }

            // If we reject the membership or there was a problem creating the account
            if (s4.request.request_status == Status.Rejected)
            {
                email = await GenerateRejection(s4, email);
            }

            if (s4.request.request_status == Status.Approved)
            {
                // add our subject and opening remark
                email = await GenerateApproval(s4, email);

                if (s4.request_type == RequestType.Primary)
                {
                    // add information pertinent only to account primaries
                    email.body += await AddPrimaryApproval(s4, email);
                }
                // add link to verify email / complete registration / set password
                email.body += await AddActivationLink(s4, email);
            }

            // Actually sends the email
            await SendEmailAsync(email, cc);

            // probably put something here to record the result n yada yada yada...
            return(res);
        }
Exemple #6
0
 // Generate email object based on status
 private Task <Email> GenerateApproval(S4Response s4, Email email)
 {
     email.subject = $@"Action Required: ***** Account Created";
     email.body    = $@"<div>Dear {s4.request.first_name},</div>";
     return(Task.FromResult(email));
 }