public async Task <ActionResult> Index(int gameId) { var userTeam = default(TeamModel); var teams = new List <TeamModel>(); var userId = User.Identity.GetUserId <int>(); var game = await GameReader.GetGame(gameId); if (game.Status == GameStatus.Finished) { return(RedirectToAction("Game", "Gallery", new { gameId = gameId })); } var user = await UserReader.GetUser(userId); if (game.Type == GameType.TeamBattle) { teams = await GameReader.GetTeams(game.Id); userTeam = await GameReader.GetUserTeam(userId, game.Id); } return(View(new PixelViewlModel { Game = game, Points = user?.Points ?? 0, Teams = teams, Team = userTeam })); }
public async Task Invoke(HttpContext context) { var user = UserReader.GetUser(context); if (user?.Entity != null) { var router = context.GetRouteData(); router.Values.TryGetValue("controller", out object value); var controller = (string)value; // Check if the user is fully authenticated if (user.Entity.AuthenticatorSecret != null && !user.FullyAuthenticated) { // When the user not fully authenticated, restrict all other controllers than authentication if (controller != "Authenticator") { context.Response.Redirect("/Authenticator/Validate"); return; } } } await next(context); }
public async Task <ActionResult> UpdateUserModal(int userId) { var user = await UserReader.GetUser(userId); return(View(new UpdateUserModal { Id = user.Id, UserName = user.UserName, Email = user.Email, Points = user.Points, IsEmailConfirmed = user.IsEmailConfirmed, IsLocked = user.IsLocked })); }
public async Task <ActionResult> Index() { var userId = User.Identity.GetUserId <int>(); var user = await UserReader.GetUser(userId); var userAwards = await AwardReader.GetUserAwardList(userId); return(View(new PointsModel { Points = user.Points, LatestPrizes = new System.Collections.Generic.List <PrizeUserHistoryItemModel>(), AwardList = userAwards })); }
public async Task <ActionResult> Index() { var user = await UserReader.GetUser(User.Identity.GetUserId <int>()); return(View(new UserSettingsModel())); }