Exemplo n.º 1
0
        public async Task <IActionResult> ConfirmEmail(int userId, string token)
        {
            if (userId == 0 || token == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var response = await _accountSvc.GetUserByIdAsync(userId);

            if (response == null)
            {
                return(NotFound($"Unable to load user with ID '{userId}'."));
            }

            var result = await _accountSvc.ConfirmEmailAsync(response.Data, token);

            if (result.HasError)
            {
                throw new InvalidOperationException($"Error confirming email for user with ID '{userId}':");
            }

            return(View());
        }