public async Task <CurrentUserVm> Handle(LoginUserQuery request, CancellationToken cancellationToken) { var vm = new CurrentUserVm(); var user = await _userManager.FindByNameAsync(request.Username); if (user != null) { var result = await _userManager.CheckPasswordAsync(user.UserName, request.Password); if (result != "") { vm.Username = user.UserName; vm.Token = result; } else { vm.Error = "Wrong password!"; vm.Username = ""; vm.Token = ""; } } else { vm.Error = "User does not exist!"; vm.Username = ""; vm.Token = ""; } return(vm); }