コード例 #1
0
        public async Task <ActionResult> ConfirmEmail(string userId, string code)
        {
            if (userId == null || code == null)
            {
                return(View("Error"));
            }

            var result = await EmailService.ConfirmEmailAsync(userId, code);

            return(View(result.Succedeed ? "ConfirmEmail" : "Error"));
        }
コード例 #2
0
        public async Task <IActionResult> ConfirmEmail(int userId, string token)
        {
            var user = await _recipeRepo.GetUser(userId);

            if (user == null || string.IsNullOrWhiteSpace(token))
            {
                return(NotFound());
            }

            var result = await _emailService.ConfirmEmailAsync(userId, token);

            if (result.IsSuccess)
            {
                // Need to come back to this to return an HTML page!
                // return Ok("Thanks for confirming your email");
                return(Redirect($"http://localhost:3000/email-confirmed?userid={userId}&token={token}"));
            }

            return(BadRequest(result));
        }