API Mask & unlock settings

This commit is contained in:
HojouFotytu 2021-02-23 16:20:51 +09:00
parent 2ad2cfef0c
commit 06ac2e98e1
5 changed files with 12 additions and 9 deletions

View File

@ -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;

View File

@ -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))

View File

@ -86,7 +86,7 @@
<div class="form-group row">
<label class="col-md-4 col-form-label">Profit Trailer Server API Token <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="The API token needed to communicate with Profit Trailer - set in Profit Trailer Server Settings"></i></label>
<div class="col-md-8">
<input type="text" class="form-control" name="Application_ProfitTrailerServerAPIToken" value="@Model.PTMagicConfiguration.GetProfitTrailerServerAPITokenMasked()">
@Model.PTMagicConfiguration.GetProfitTrailerServerAPITokenMasked()
</div>
</div>

View File

@ -71,7 +71,6 @@ namespace Monitor.Pages
PTMagicConfiguration.GeneralSettings.Application.StartBalance = SystemHelper.TextToDouble(HttpContext.Request.Form["Application_StartBalance"], PTMagicConfiguration.GeneralSettings.Application.StartBalance, "en-US");
PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerDefaultSettingName = HttpContext.Request.Form["Application_ProfitTrailerDefaultSettingName"];
PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerServerAPIToken = HttpContext.Request.Form["Application_ProfitTrailerServerAPIToken"];
PTMagicConfiguration.GeneralSettings.Application.TimezoneOffset = HttpContext.Request.Form["Application_TimezoneOffset"];
PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency = HttpContext.Request.Form["Application_MainFiatCurrency"];

View File

@ -107,7 +107,7 @@
</li>
} else {
<li>
<a data-toggle="tooltip" data-placement="top" title="Settings menu is only accessible when you protect your monitor with a password!"><i class="fa fa-lock text-danger"></i> <span> Settings</span></a>
<a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)Login" data-toggle="tooltip" data-placement="top" title="Settings menu is only accessible when you protect your monitor with a password!"><i class="fa fa-lock text-danger"></i> <span> Settings</span></a>
</li>
}