public async Task Handle(ResetPasswordCommand request, CancellationToken cancellationToken)
        {
            if (!request.IsValid())
            {
                NotifyValidationErrors(request);
                return;
            }

            var emailSent = await _userService.ResetPassword(request);

            if (emailSent.HasValue)
            {
                await Bus.RaiseEvent(new AccountPasswordResetedEvent(emailSent.Value, request.Email, request.Code));
            }
        }
Exemple #2
0
        public async Task <bool> Handle(ResetPasswordCommand request, CancellationToken cancellationToken)
        {
            if (!request.IsValid())
            {
                NotifyValidationErrors(request);
                return(false);
            }

            var emailSent = await _userService.ResetPassword(request.Email, request.Code, request.Password);

            if (emailSent != null)
            {
                await Bus.RaiseEvent(new AccountPasswordResetedEvent(emailSent, request.Email, request.Code));

                return(true);
            }
            return(false);
        }