From c76db92c55ebaac3d277510c2b3298a1f25220be Mon Sep 17 00:00:00 2001 From: SimonFlapse Date: Mon, 1 Jun 2020 21:26:28 +0200 Subject: [PATCH] Deleting DefaultAccount file when user is removed --- FactorioWebInterface/Services/DefaultAdminAccountService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FactorioWebInterface/Services/DefaultAdminAccountService.cs b/FactorioWebInterface/Services/DefaultAdminAccountService.cs index 7b896e84..c1166232 100644 --- a/FactorioWebInterface/Services/DefaultAdminAccountService.cs +++ b/FactorioWebInterface/Services/DefaultAdminAccountService.cs @@ -92,6 +92,7 @@ private async Task ValidateOrClearDefaultUserAsync(string id, bool force = false Log.Error("{UserId} couldn't be deleted! This may pose a security risk for your application. Will attempt to delete again at next reboot", Constants.DefaultAdminAccount); } Log.Information("{UserId} deleted", Constants.DefaultAdminAccount); + DeleteDefaultAccountFile(); } } @@ -155,11 +156,11 @@ private async Task CreateDefaultUserAsync(string id) string warningTag = "! - Warning - !"; var path = GetDefaultAccountFilePath(); - RemoveDefaultAccountFile(); + DeleteDefaultAccountFile(); File.WriteAllText(path, $"{warningTag}\nThis account is unsecure. Please setup a personal account.\n{warningTag}\nUsername: {userName}\nPassword: {password}"); } - private void RemoveDefaultAccountFile() + private void DeleteDefaultAccountFile() { var path = GetDefaultAccountFilePath(); try