public IActionResult Index() { try { string username = User.Claims.FirstOrDefault(y => y.Type == "user_id").Value; var user = userService.FindUserById(username); aiService.TrackUser("Homepage", username); if (user == null || string.IsNullOrEmpty(user.topics)) { ViewBag.user = string.Empty; } else { ViewBag.user = user.Id; } ViewBag.title = "Home"; ViewBag.LastTopics = topicService.GetLastTopics(); ViewBag.TrendingTopics = topicService.GetTrendingTopics(); } catch (Exception ex) { aiService.TrackException(ex); } return(View()); }
public IActionResult Logout() { string username = User.Claims.FirstOrDefault(y => y.Type == "user_id").Value; aiService.TrackUser("Logout", username); HttpContext.Authentication.SignOutAsync("Auth0"); HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); return(RedirectToAction("Index", "Home")); }