public void OnPost(string OldPassword, string Password, string PasswordConfirm) { base.PreInit(); ValidationMessage = "Test"; string encryptedOldPassword = null; if (OldPassword != null) { encryptedOldPassword = EncryptionHelper.Encrypt(OldPassword); if (!Password.Equals(PasswordConfirm) || !encryptedOldPassword.Equals(PTMagicConfiguration.SecureSettings.MonitorPassword) && System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "/settings.secure.json")) { ValidationMessage = "Old Password wrong or new Password does not match with confirmation"; } else if (ModelState.IsValid) { PTMagicConfiguration.WriteSecureSettings(Password); ValidationMessage = ""; Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login"); } } else { if (!Password.Equals(PasswordConfirm) && !System.IO.File.Exists(System.IO.Directory.GetCurrentDirectory().Split("Monitor")[0] + "/settings.secure.json")) { ValidationMessage = "New Password does not match with confirmation"; } else if (ModelState.IsValid) { PTMagicConfiguration.WriteSecureSettings(Password); ValidationMessage = ""; Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login"); } } }
public void OnPost(string password, string passwordConfirm) { if (!password.Equals(passwordConfirm)) { ValidationMessage = "Password does not match the confirmation!"; } if (ModelState.IsValid) { base.PreInit(); PTMagicConfiguration.WriteSecureSettings(password, PTMagicBasePath); Response.Redirect(PTMagicConfiguration.GeneralSettings.Monitor.RootUrl + "Login"); } }