コード例 #1
0
        public async Task <Unit> Handle(ResetPasswordRequest request, CancellationToken cancellationToken)
        {
            var user = await userManager.FindByEmailAsync(request.Email);

            if (user == null)
            {
                throw new NotExistentUserException();
            }

            var token = await userManager.GeneratePasswordResetTokenAsync(user);

            var model = MailModel.Create(
                "Recupero de contraseña",
                new ResetPasswordEmailData(token, $"{frontendOptions.Url}{frontendOptions.ForgotPassword}"));

            await mailingService.SendEmailAsync(
                user.Email, model.Subject, await request.GetEmailBody(model));

            return(Unit.Value);
        }