From 100cd1c604d5d752d46a9f7c5fcb6b1ca5d3c5a2 Mon Sep 17 00:00:00 2001 From: Vasilis The Pikachu Date: Tue, 28 Oct 2025 22:19:48 +0100 Subject: [PATCH 1/4] Add account creation time on profile page Imports humanizer, `Microsoft.EntityFrameworkCore.Tools` was already importing it so its probably not a big issue from what i was told. Installed the exact same version as well. --- .../Identity/Pages/Account/Manage/Index.cshtml | 12 +++++++++++- .../Pages/Account/Manage/Index.cshtml.cs | 16 +++++++++------- SS14.Web/SS14.Web.csproj | 1 + 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml b/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml index c6b2325..7582dba 100644 --- a/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml +++ b/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml @@ -1,4 +1,5 @@ @page +@using Humanizer @model IndexModel @{ ViewData["Title"] = "Profile"; @@ -8,6 +9,15 @@

@ViewData["Title"]

+
+
+
Profile details
+
+
+

This account was created on + @TimeZoneInfo.ConvertTimeFromUtc(Model.CreatedTime.DateTime, TimeZoneInfo.Local).ToString("MMMM d, yyyy h:mm tt zzz") + (@( (DateTimeOffset.Now - Model.CreatedTime).Humanize(3, countEmptyUnits:true)) ago)

+
Username
@@ -37,4 +47,4 @@ @section Scripts { -} \ No newline at end of file +} diff --git a/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs b/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs index 79253f6..891b76d 100644 --- a/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs +++ b/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml.cs @@ -19,10 +19,11 @@ public partial class IndexModel : PageModel public bool CanEditUsername { get; set; } public int UsernameChangeDelay => _options.Value.UsernameChangeDays; public DateTime NextUsernameChangeAllowed { get; set; } + public DateTimeOffset CreatedTime { get; set; } public IndexModel( SpaceUserManager userManager, - SignInManager signInManager, + SignInManager signInManager, IOptions options, ApplicationDbContext dbContext, AccountLogManager accountLogManager) @@ -44,6 +45,7 @@ private async Task LoadAsync(SpaceUser user) var userName = await _userManager.GetUserNameAsync(user); Username = userName; + CreatedTime = user.CreatedTime; UpdateCanEditUsername(user); } @@ -88,13 +90,13 @@ public async Task OnPostUsernameAsync() await LoadAsync(user); return Page(); } - + Username = Username.Trim(); if (Username == user.UserName) { return RedirectToPage(); } - + UpdateCanEditUsername(user); if (!CanEditUsername) { @@ -107,7 +109,7 @@ public async Task OnPostUsernameAsync() await using var tx = await _dbContext.Database.BeginTransactionAsync(); var result = await _userManager.SetUserNameAsync(user, Username); - + if (!result.Succeeded) { foreach (var error in result.Errors) @@ -118,17 +120,17 @@ public async Task OnPostUsernameAsync() await LoadAsync(user); return Page(); } - + user.LastUsernameChange = DateTime.UtcNow; await _accountLogManager.LogNameChanged(user, oldName, user.UserName); await _signInManager.RefreshSignInAsync(user); StatusMessage = "Your username has been changed. Note that it may take some time to visibly update in some places, such as the launcher."; - + await _dbContext.SaveChangesAsync(); await tx.CommitAsync(); return RedirectToPage(); } -} \ No newline at end of file +} diff --git a/SS14.Web/SS14.Web.csproj b/SS14.Web/SS14.Web.csproj index 1b5c315..af8e21f 100644 --- a/SS14.Web/SS14.Web.csproj +++ b/SS14.Web/SS14.Web.csproj @@ -6,6 +6,7 @@ + From 238834c524ec99cae22234b77be620463abc53e1 Mon Sep 17 00:00:00 2001 From: Vasilis The Pikachu Date: Wed, 4 Feb 2026 14:45:34 +0100 Subject: [PATCH 2/4] I give up on humanizer Kinda was more of a gimmick if anything i assume people can calculate. --- SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml | 2 -- SS14.Web/SS14.Web.csproj | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml b/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml index 7582dba..81c245c 100644 --- a/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml +++ b/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml @@ -1,5 +1,4 @@ @page -@using Humanizer @model IndexModel @{ ViewData["Title"] = "Profile"; @@ -16,7 +15,6 @@

This account was created on @TimeZoneInfo.ConvertTimeFromUtc(Model.CreatedTime.DateTime, TimeZoneInfo.Local).ToString("MMMM d, yyyy h:mm tt zzz") - (@( (DateTimeOffset.Now - Model.CreatedTime).Humanize(3, countEmptyUnits:true)) ago)

diff --git a/SS14.Web/SS14.Web.csproj b/SS14.Web/SS14.Web.csproj index af8e21f..45f2fbe 100644 --- a/SS14.Web/SS14.Web.csproj +++ b/SS14.Web/SS14.Web.csproj @@ -6,7 +6,6 @@ - @@ -17,12 +16,12 @@ - + - + <_ContentIncludedByDefault Remove="Areas\Admin\Pages\Servers\BannedAddresses\Index.cshtml" /> From 80426a2d34297220494f018b25e0a27ce6eb9f4b Mon Sep 17 00:00:00 2001 From: Vasilis The Pikachu Date: Wed, 4 Feb 2026 14:46:47 +0100 Subject: [PATCH 3/4] Awa --- SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml | 1 - SS14.Web/SS14.Web.csproj | 2 -- 2 files changed, 3 deletions(-) diff --git a/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml b/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml index 81c245c..3781c70 100644 --- a/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml +++ b/SS14.Web/Areas/Identity/Pages/Account/Manage/Index.cshtml @@ -15,7 +15,6 @@

This account was created on @TimeZoneInfo.ConvertTimeFromUtc(Model.CreatedTime.DateTime, TimeZoneInfo.Local).ToString("MMMM d, yyyy h:mm tt zzz") -

Username
diff --git a/SS14.Web/SS14.Web.csproj b/SS14.Web/SS14.Web.csproj index 45f2fbe..eca5d08 100644 --- a/SS14.Web/SS14.Web.csproj +++ b/SS14.Web/SS14.Web.csproj @@ -16,12 +16,10 @@ - - <_ContentIncludedByDefault Remove="Areas\Admin\Pages\Servers\BannedAddresses\Index.cshtml" /> From 8fcd18fd296efc7ba7eaf2c924a9459cb2da4c76 Mon Sep 17 00:00:00 2001 From: Vasilis The Pikachu Date: Wed, 4 Feb 2026 14:49:09 +0100 Subject: [PATCH 4/4] Ok i will just manually git checkout this --- SS14.Web/SS14.Web.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SS14.Web/SS14.Web.csproj b/SS14.Web/SS14.Web.csproj index eca5d08..1b5c315 100644 --- a/SS14.Web/SS14.Web.csproj +++ b/SS14.Web/SS14.Web.csproj @@ -16,10 +16,12 @@ + + <_ContentIncludedByDefault Remove="Areas\Admin\Pages\Servers\BannedAddresses\Index.cshtml" />