Ejemplo n.º 1
0
        public ActionResult ConfirmEmail([FromBody] ConfirmEmailViewModel model)
        {
            string email = _userBll.GetEmailFromToken(model.Token);
            var    user  = _userBll.GetUserByEmail(email);

            if (user != null)
            {
                if (_userBll.ConfirmUserEmail(user.Id))
                {
                    var encodedJwt = new JwtSecurityTokenHandler().WriteToken(GetJwtToken(user));

                    var response = new
                    {
                        accessToken = encodedJwt,
                        email       = user.Email,
                    };

                    return(Ok(Json(response)));
                }
            }

            return(BadRequest());
        }