public IActionResult Validate([FromQuery(Name = "email")] string email) { string token = Request.Headers["Token"]; var u = _loginsvc.GetUser(email); if (u == null) { return(NotFound("User not found.")); } var userId = _jwtBuilder.ValidateToken(token); if (userId != u.Id) { _loginsvc.UpdateTokenStatus(token); return(BadRequest("Invalid token.")); } var chk = _loginsvc.CheckAuthentication(userId, token); if (chk == "Failed") { return(BadRequest("Invalid token.")); } var ur = _loginsvc.GetUSerDetails(userId); if (ur == null) { return(NotFound("User not found.")); } return(Ok(ur)); }
public IActionResult Validate([FromQuery(Name = "email")] string email, [FromQuery(Name = "token")] string token) { var u = _userRepository.GetUser(email); if (u == null) { return(NotFound("User not found.")); } var userId = _jwtBuilder.ValidateToken(token); if (userId != u.Id) { return(BadRequest("Invalid token.")); } return(new OkObjectResult(userId)); }