implement proper messages on error
This commit is contained in:
parent
b9a625ee1a
commit
24a50dd244
|
@ -45,6 +45,11 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="text-danger m-l-10">
|
||||||
|
@Model.ValidationMessage
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Monitor.Pages
|
||||||
public void OnPost(string OldPassword, string Password, string PasswordConfirm)
|
public void OnPost(string OldPassword, string Password, string PasswordConfirm)
|
||||||
{
|
{
|
||||||
base.PreInit();
|
base.PreInit();
|
||||||
|
ValidationMessage = "Test";
|
||||||
string encryptedOldPassword = null;
|
string encryptedOldPassword = null;
|
||||||
|
|
||||||
if (OldPassword != null)
|
if (OldPassword != null)
|
||||||
|
@ -29,11 +29,12 @@ namespace Monitor.Pages
|
||||||
|
|
||||||
if (!Password.Equals(PasswordConfirm) || !encryptedOldPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword) && System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "settings.secure.json"))
|
if (!Password.Equals(PasswordConfirm) || !encryptedOldPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword) && System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "settings.secure.json"))
|
||||||
{
|
{
|
||||||
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "SetupPassword");
|
ValidationMessage = "Old Password wrong or new Password does not match with confirmation";
|
||||||
}
|
}
|
||||||
else if (ModelState.IsValid)
|
else if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
PTMagicConfiguration.WriteSecureSettings(Password);
|
PTMagicConfiguration.WriteSecureSettings(Password);
|
||||||
|
ValidationMessage = "";
|
||||||
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
|
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,11 +42,12 @@ namespace Monitor.Pages
|
||||||
{
|
{
|
||||||
if (!Password.Equals(PasswordConfirm) && !System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "settings.secure.json"))
|
if (!Password.Equals(PasswordConfirm) && !System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "settings.secure.json"))
|
||||||
{
|
{
|
||||||
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "SetupPassword");
|
ValidationMessage = "New Password does not match with confirmation";
|
||||||
}
|
}
|
||||||
else if (ModelState.IsValid)
|
else if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
PTMagicConfiguration.WriteSecureSettings(Password);
|
PTMagicConfiguration.WriteSecureSettings(Password);
|
||||||
|
ValidationMessage = "";
|
||||||
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
|
Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue