Merge pull request #277 from HojouFotytu/develop
API Mask & unlock settings
This commit is contained in:
commit
1da425219e
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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"];
|
||||
|
||||
|
|
|
@ -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>
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Core.Main;
|
||||
using Core.Helper;
|
||||
|
@ -27,7 +28,8 @@ namespace Monitor._Internal
|
|||
// Security check
|
||||
if (!IsLoggedIn(this.HttpContext))
|
||||
{
|
||||
HttpContext.Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + _redirectUrl);
|
||||
this.HttpContext.Response.Clear();
|
||||
this.HttpContext.Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + _redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue