From cc142e2ce5c66ec5599c6d26c15b9eadaceb0d4b Mon Sep 17 00:00:00 2001 From: Thomas Wiedebusch Date: Mon, 20 Oct 2025 17:31:58 +0200 Subject: [PATCH] GTB: - unambiguous messages on password repair --- Common/Ui/GenesisToolBox/FrmLowLevelTools.cs | 66 +++++++++++--------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs b/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs index a30b219a..14c14df9 100644 --- a/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs +++ b/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs @@ -268,6 +268,9 @@ namespace Xylem.Common.Ui.GenesisToolBox /// /// - Actions on pwdContainer error. /// + /// + /// - Password checks extended. + /// private void Connect() { try @@ -313,6 +316,7 @@ namespace Xylem.Common.Ui.GenesisToolBox { LowLevelActionControl(false); LogErrorText("ERROR: Cannot read out PcbId! Access to Cordonel denied!"); + LogText(StrSeparator); return; } @@ -325,7 +329,8 @@ namespace Xylem.Common.Ui.GenesisToolBox string.IsNullOrEmpty(pwdContainer.Skeleton))) { LowLevelActionControl(false); - LogErrorText("ERROR: Login failed and passwords cannot be acquired from database!"); + LogErrorText("ERROR: Login failed and passwords cannot be acquired from the database!"); + LogText(StrSeparator); return; } @@ -350,7 +355,7 @@ namespace Xylem.Common.Ui.GenesisToolBox // CASE 1: - The 'offline password' is valid and equals the 'Lvl8 password' and the // 'production password' LogText("The 'production password' is the 'Lvl8 password'\n" + - "Installed password file is valid and compared with database"); + "Installed password file is valid and compared with the database"); } else { @@ -358,7 +363,7 @@ namespace Xylem.Common.Ui.GenesisToolBox // 'production password' is not correctly updated ShowPasswordRepairMessage( "The 'production password' is not correctly set to the 'Lvl8 password'\n" + - "Installed password file is valid and compared with database\n" + + "Installed password file is valid and compared with the database\n" + "[Repair Password] enabled"); } } @@ -366,7 +371,7 @@ namespace Xylem.Common.Ui.GenesisToolBox else if (_currentGenesis.OfflinePassword.Equals(pwdContainer.Skeleton)) ShowPasswordRepairMessage( "The 'offline password' is the 'SkeletonKey'\n" + - "Password exists on database but password file not installed'\n" + + "Password exists on the database but password file not installed'\n" + "[Repair Password] enabled"); }// The 'offline password' is in use else // The 'production password' is in use @@ -376,7 +381,7 @@ namespace Xylem.Common.Ui.GenesisToolBox // CASE 4: - The 'production password' is the 'Lvl8 password' as the login succeeded. LogText( "Successfully logged in with the 'production password' which equals the 'Lvl8 password'\n" + - "Installed password file is valid and compared with database"); + "Installed password file is valid and compared with the database"); } else if (pwdContainer.Password.Equals(pwdContainer.Skeleton)) { @@ -387,7 +392,7 @@ namespace Xylem.Common.Ui.GenesisToolBox // CASE 5: - The 'production password' is the 'SkeletonKey' as the login succeeded. ShowPasswordRepairMessage( "Successfully logged in with the 'production password' which equals the 'SkeletonKey'\n" + - "Password exists on database but password file not installed'\n" + + "Password exists on the database but password file not installed'\n" + "[Repair Password] enabled"); } } @@ -396,14 +401,14 @@ namespace Xylem.Common.Ui.GenesisToolBox { // CASE 6: - The login succeeded but the password file request from database failed LogText("Successfully logged in with the 'offline password'.\n" + - "Passwords cannot be acquired from database and therefore not compared"); + "Passwords cannot be acquired from the database and therefore not compared"); } }// Initial login succeeded // Login can only be tried on valid database collection of passwords if (!retValPwdBuild) { - sb.AppendLine(@"Passwords cannot be acquired from database [E0]!"); + sb.AppendLine(@"Passwords cannot be acquired from the database [E0]!"); } // As the initial login wasn't successfully, try the acquired combinations from the database passwords else if (!_currentGenesis.IsLoggedOn) @@ -418,8 +423,8 @@ namespace Xylem.Common.Ui.GenesisToolBox if (_currentGenesis.IsLoggedOn && retVal) { ShowPasswordRepairMessage("Successfully logged in with 'Lvl8 password'\n" + - "Installed password file is valid and compared with database!\n" + - "'production password' in database not actual, update required\n" + + "Installed password file is valid and compared with the database!\n" + + "'production password' in the database not actual, update required\n" + "[Repair Password] enabled"); } else @@ -435,7 +440,7 @@ namespace Xylem.Common.Ui.GenesisToolBox if (_currentGenesis.Login(pwdContainer.Skeleton)) { ShowPasswordRepairMessage("Successfully logged in with 'SkeletonKey'\n" + - "'production password' in database not actual, update required\n" + + "'production password' in the database not actual, update required\n" + "[Repair Password] enabled"); } else @@ -493,10 +498,12 @@ namespace Xylem.Common.Ui.GenesisToolBox if (!_currentGenesis.IsLoggedOn) { + LogText(StrSeparator); return; } _meterFile = new MeterFile(_currentGenesis); + LogText(StrSeparator); Invoke(new Action(() => { @@ -2170,73 +2177,74 @@ namespace Xylem.Common.Ui.GenesisToolBox Task.Factory.StartNew(() => { // Request password file and force generation - SetActualProcessAndLog("Request password files from database"); + SetActualProcessAndLog("Request passwords from the database"); var ret = MeterPwdHandlerDb.RequestPwdFileFromDb(_currentGenesis.GetPcbId(), out var pwdContainer); if (pwdContainer?.ListOfHashes == null || pwdContainer.ListOfPasswords == null || !ret) { - LogText(@"Password file from server corrupted [M3]!"); + LogText(@"Passwords from server corrupted [M3]!"); LowLevelActionControl(false); return; } // Build password file - SetActualProcessAndLog("Build password file"); + SetActualProcessAndLog("Build 'password file'"); var _meterPwdFile = new MeterPwdFile(_currentGenesis); var retValBol = _meterPwdFile.BuildPwdFile(pwdContainer.ListOfPasswords, 1, pwdContainer.Skeleton); if (!retValBol) { - LogText(@"Unable to build password file [M3]!"); + LogText(@"Unable to build 'password file' [M3]!"); LowLevelActionControl(false); return; } // Install password file and verify byte wise - SetActualProcessAndLog("Install and verify password file into meter"); + SetActualProcessAndLog("Install 'password file' into meter, read it out and verify it"); _currentGenesis.ReLogin(); retValBol = _meterPwdFile.UnlockEraseWriteMeterPwdFile(); retValBol &= _meterPwdFile.WriteMeterPwdFile() && _meterPwdFile.VerifyMeterPwdFile(); if (!retValBol) { - LogText(@"Installed password file check failed [M4]!"); + LogErrorText(@"ERROR: Installed 'password file' check failed [M4]!"); return; } // Check if new password is in the meter with login level 8 even if the file write wasn't successful - SetActualProcessAndLog("Validate Lvl8 password from password file"); + SetActualProcessAndLog("Validate 'Lvl8 password' from 'password file'"); _currentGenesis.Logout(); retValBol = _currentGenesis.Login(Encoding.UTF8.GetString(pwdContainer.ListOfPasswords.Last())); if (!retValBol) { - LogText(@"Login with new password failed [M4]!"); + LogErrorText(@"ERROR: Login with 'Lvl8 password' failed [M4]!"); return; } - LogText(@"Password was successfully installed."); + LogText(@"Successfully installed the 'password file'"); // Set new password in production database - SetActualProcessAndLog("Replace SkeletonKey with Lvl8 password as production password in database"); + SetActualProcessAndLog( + "Replace 'SkeletonKey' with 'Lvl8 password' as 'production password' in the database"); retValBol = MeterPwdHandlerDb.SetPwdFromSkeletonToLvl8inDd(_currentGenesis.PcbId, pwdContainer); if (!retValBol) { - LogText(@"Update of production password in database failed [E3]!"); + LogErrorText(@"ERROR: Update of 'production password' in the database failed [E3]!"); return; } - LogText(@"Production password successfully updated in database"); + LogText(@"Successfully updated 'production password' in the database"); // Check password level 3 as all applications need to use this - SetActualProcessAndLog("Validate Lv3 as SkeletonKey in meter"); + SetActualProcessAndLog("Validate 'Lv3 password' as 'SkeletonKey' in meter (used by meter-apps)"); retValBol = _currentGenesis.WriteRegister("SYSTEM_ExitReason", new Byte[] { 21 }); var exitResult = RegisterConverter.ByteArrayToValue(_currentGenesis.ReadRegister("SYSTEM_ExitReason")); if (exitResult != 0 || !retValBol) { - LogText(@"Meter reports wrong SkeletonKey at Lvl3 [M4]!"); + LogErrorText(@"ERROR: Meter reports wrong 'SkeletonKey' at 'Lvl3 password' [M4]!"); return; } - LogText(@"Meter reports correct SkeletonKey at Lvl3."); + LogText(@"Meter reports correct 'SkeletonKey' as 'Lvl3 password'"); // Clear intermediate stored password to force password collection from DB on simple login without // given new password. Then the password will be taken from the DB or offline file. - SetActualProcessAndLog("Crosscheck production password with meter password Lvl8"); + SetActualProcessAndLog("Crosscheck 'production password' with meter 'Lvl8 password"); _currentGenesis.Logout(); _currentGenesis.ClearPassword(); @@ -2248,10 +2256,10 @@ namespace Xylem.Common.Ui.GenesisToolBox if (!retValBol) { - LogText(@"Invalid password in production database [E3]!"); + LogErrorText(@"ERROR: Invalid 'production password' in the production database [E3]!"); return; } - LogText(@"Password Lvl8 successfully validated with production database."); + LogText(@"Successfully validated 'Lvl8 password' of the production database"); _repairPasswordEnabled = false; }).ContinueWith(delegate {