public void SavePasswordResetRequest(PasswordResetRequest request) { try { request.CreatedDate = DateTime.UtcNow; db.PasswordResetRequests.Add(request); db.SaveChanges(); } catch (Exception ex) { throw; } }
public void SavePasswordResetRequest(UserAccountDto userAccount, string activationLink) { try { var request = new PasswordResetRequest { ActivationCode = activationLink, UserID = userAccount.Id }; request.CreatedDate = DateTime.UtcNow; db.PasswordResetRequests.Add(request); db.SaveChanges(); } catch (Exception) { throw; } }
public void SendResetPasswordEmail(PasswordResetRequest request) { var emailTemplate = repo.GetEmailTemplate("ResetPassword"); if (emailTemplate != null) { string emailSubject = emailTemplate.EmailSubject; string emailBody = emailTemplate.EmailBody; Email email = new Email(); email.ToAddress.Add(request.User.EmailAddress); string joinLink = String.Format("{0}Account/resetpassword/{1}", SiteBaseURL, request.ActivationCode); emailBody = emailBody.Replace("@resetLink", joinLink); email.Body = emailBody; email.Subject = emailSubject; email.Send(); } }