From 06ac2e98e175f83ae60385ac1739e2bd982c5a86 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 23 Feb 2021 16:20:51 +0900 Subject: [PATCH] API Mask & unlock settings --- Core/Main/PTMagicConfiguration.cs | 13 ++++++++----- Monitor/Pages/Login.cshtml.cs | 3 ++- Monitor/Pages/SettingsGeneral.cshtml | 2 +- Monitor/Pages/SettingsGeneral.cshtml.cs | 1 - Monitor/Pages/_Layout.cshtml | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Core/Main/PTMagicConfiguration.cs b/Core/Main/PTMagicConfiguration.cs index 3033a40..3931664 100644 --- a/Core/Main/PTMagicConfiguration.cs +++ b/Core/Main/PTMagicConfiguration.cs @@ -84,14 +84,17 @@ namespace Core.Main if (!this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Equals("")) { - result = this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Substring(0, 4); - - for (int i = 1; i < this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Length - 8; i++) + int tokenLength = this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Length; + if (tokenLength == 1) + { + result = "*"; + } + else + result = this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Substring(0, 1); + for (int i = 1; i < this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Length; i++) { result += "*"; } - - result += this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Substring(this.GeneralSettings.Application.ProfitTrailerServerAPIToken.Length - 4); } return result; diff --git a/Monitor/Pages/Login.cshtml.cs b/Monitor/Pages/Login.cshtml.cs index 6958d1a..44c35c5 100644 --- a/Monitor/Pages/Login.cshtml.cs +++ b/Monitor/Pages/Login.cshtml.cs @@ -30,7 +30,8 @@ namespace Monitor.Pages if (encryptedPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword)) { HttpContext.Session.SetString("LoggedIn" + PTMagicConfiguration.GeneralSettings.Monitor.Port.ToString(), DateTime.UtcNow.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'")); - + PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected = true; + PTMagicConfiguration.WriteGeneralSettings(); if (cbRememberMe != null) { if (cbRememberMe.Equals("on", StringComparison.InvariantCultureIgnoreCase)) diff --git a/Monitor/Pages/SettingsGeneral.cshtml b/Monitor/Pages/SettingsGeneral.cshtml index 87caf80..168434d 100644 --- a/Monitor/Pages/SettingsGeneral.cshtml +++ b/Monitor/Pages/SettingsGeneral.cshtml @@ -86,7 +86,7 @@