Skip to content

Commit

Permalink
Deleting DefaultAccount file when user is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonFlapse authored and grilledham committed Aug 22, 2020
1 parent 1920cd2 commit c76db92
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions FactorioWebInterface/Services/DefaultAdminAccountService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c76db92

Please sign in to comment.