Example #1
0
        public async Task <IActionResult> ConfirmEmail(string userId, string token)
        {
            if (userId == null || token == null)
            {
                return(BadRequest("Unable to confirm without submitted email-address and/or password"));
            }

            var user = await _registerService.CheckIfUserIdExistsAsync(userId);

            if (user == null)
            {
                return(BadRequest(user.ToString()));
            }

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

            if (result)
            {
                return(Ok(new Response {
                    Success = true
                }));
            }

            return(BadRequest("Confirmation email could not be sent."));
        }