public async Task SendConfirmationEmail(User user) { user.ConfirmationToken = PasswordHash.CreateSalt(); await userRepository.Update(user); var mailModel = new AccountConfirmation("Account Confirmation", user.Email, ConfigurationManager.AppSettings["WebsiteUrl"] + "#/confirm?token=" + HttpUtility.UrlEncode(user.ConfirmationToken)); await emailSender.Send(mailModel); }
public Task<bool> ForgotPassword(long userId) { var user = userRepository.Find(userId).Result; if (user == null) return Task.FromResult(false); user.ForgotPasswordToken = PasswordHash.CreateSalt(); user.ForgotPasswordTimeStamp = DateTime.UtcNow; userRepository.Update(user); var mailModel = new AccountConfirmation("Password Reset", user.Email, ConfigurationManager.AppSettings["WebsiteUrl"] + "#/setpassword?token=" + HttpUtility.UrlEncode(user.ForgotPasswordToken)); emailSender.Send(mailModel); return Task.FromResult(true); }