diff --git a/ProjectLighthouse/Pages/LandingPage.cshtml b/ProjectLighthouse/Pages/LandingPage.cshtml index fc67aaae..3a977b88 100644 --- a/ProjectLighthouse/Pages/LandingPage.cshtml +++ b/ProjectLighthouse/Pages/LandingPage.cshtml @@ -1,5 +1,6 @@ @page "/" @using LBPUnion.ProjectLighthouse.Types +@using LBPUnion.ProjectLighthouse.Types.Settings @model LBPUnion.ProjectLighthouse.Pages.LandingPage @{ @@ -11,6 +12,12 @@ @if (Model.User != null) {

You are currently logged in as @Model.User.Username.

+ if (ServerSettings.Instance.UseExternalAuth && Model.AuthenticationAttemptsCount > 0) + { +

+ You have @Model.AuthenticationAttemptsCount authentication attempts pending. Click here to view them. +

+ } } @if (Model.PlayersOnlineCount == 1) @@ -21,6 +28,7 @@ @user.Username } } + else if (Model.PlayersOnlineCount == 0) {

There are no users online. Why not hop on?

diff --git a/ProjectLighthouse/Pages/LandingPage.cshtml.cs b/ProjectLighthouse/Pages/LandingPage.cshtml.cs index 23289463..de398d10 100644 --- a/ProjectLighthouse/Pages/LandingPage.cshtml.cs +++ b/ProjectLighthouse/Pages/LandingPage.cshtml.cs @@ -16,6 +16,8 @@ namespace LBPUnion.ProjectLighthouse.Pages public List PlayersOnline; public int PlayersOnlineCount; + + public int AuthenticationAttemptsCount; public LandingPage(Database database) : base(database) {} @@ -27,6 +29,13 @@ namespace LBPUnion.ProjectLighthouse.Pages this.PlayersOnlineCount = await StatisticsHelper.RecentMatches(); + if (user != null) + { + this.AuthenticationAttemptsCount = await this.Database.AuthenticationAttempts.Include + (a => a.GameToken) + .CountAsync(a => a.GameToken.UserId == user.UserId); + } + List userIds = await this.Database.LastContacts.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).Select(l => l.UserId).ToListAsync(); this.PlayersOnline = await this.Database.Users.Where(u => userIds.Contains(u.UserId)).ToListAsync();