Exemplo n.º 1
0
            public async Task <bool> Handle(UpdateUserCommand request, CancellationToken cancellationToken)
            {
                if (request.NewPassword != null)
                {
                    var result = await _userManager.ChangePasswordAsync(_userName, request.OldPassword, request.NewPassword);

                    if (request.Email != null)
                    {
                        var emailResult = await _userManager.GenerateChangeEmailTokenAsync(_userName, request.Email);

                        if (emailResult.Succeeded)
                        {
                            return(true);
                        }

                        return(false);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(request.Email))
                    {
                        var emailResult = await _userManager.GenerateChangeEmailTokenAsync(_userName, request.Email);

                        if (emailResult.Succeeded)
                        {
                            return(true);
                        }

                        return(false);
                    }
                }

                return(false);
            }