예제 #1
0
 private void SendRegistrationMail(PostRegisterUser user, string token)
 {
     using (SmtpClient client = new SmtpClient()
     {
         EnableSsl = sMTP.SSL,
         Credentials = new NetworkCredential(sMTP.UserName, sMTP.Password),
         Port = sMTP.Port
     })
     {
         MailMessage   message = new MailMessage(sMTP.FromAccount, user.Email);
         StringBuilder sb      = new StringBuilder();
         sb.AppendLine($"Hi {user.Name}");
         sb.AppendLine($"Please <a href='registration/verfiyaccount/{token}'>click here</a> to verify your account.!!!");
         sb.AppendLine();
         sb.AppendLine("Thanks,");
         message.Body       = sb.ToString();
         message.IsBodyHtml = true;
         message.Subject    = "Innova Solution Account Verification";
         client.Send(message);
     }
 }
예제 #2
0
        public async Task <IActionResult> Register(PostRegisterUser postRegister)
        {
            var result = await _registration.RegisterAsync(new WriteModel.Registration.RegisterUser
            {
                DOB      = postRegister.DOB,
                Email    = postRegister.Email,
                Phone    = postRegister.Phone,
                Name     = postRegister.Name,
                Password = _aES.GetComputedHashKey(postRegister.Password),
                UserName = postRegister.Email
            }, cancellationToken : default);

            if (result.Status == Status.Success)
            {
                var token = await _registration.InitiateVerificationAsync(result.Data);

                SendRegistrationMail(postRegister, token.Data);
            }

            return(Ok(result));
        }