public async Task <ActionResult <AppUserDto> > GetUserFromToken() { var username = User.Identity.Name; var user = await _userService.GetByUsername(username); if (user == null) { return(BadRequest(new ApiErrorDto { Message = "Unable to find the user." })); } if (!user.IsRegistrationAccepted()) { return(BadRequest(new ApiErrorDto { Message = "User is not yet accepted. Please contact the admin." })); } var respUserDto = _mapper.Map <AppUserDto>(user); return(respUserDto); }