Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -r09a43d162e61ae02c73364e050d90957d736f322 -r4696b5fa37cc2ee744582fc70228736cad55ca63 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 09a43d162e61ae02c73364e050d90957d736f322) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 4696b5fa37cc2ee744582fc70228736cad55ca63) @@ -237,19 +237,13 @@ } UserConfirmation { id: _servicePassword - property bool isDefaultPasswordSet : (vSettings.servicePass != "") - + property bool isPassword_Accepted : false + property bool isDefaultPasswordSet : (vSettings.servicePass != "") + onIsDefaultPasswordSetChanged: console.log(vSettings.servicePass) itemIndex : SettingsStack.Services - title : qsTr("Service Password") + title : isDefaultPasswordSet ? qsTr("Service Password") : qsTr("Set Service Password") isPassword: true showPasswordReEntryField: !isDefaultPasswordSet - onVisibleChanged: { - if (visible) { - if (!isDefaultPasswordSet) { - _servicePassword.title = qsTr("Default Service Password") - } - } - } onBackClicked : { clearPassword() if(!isDefaultPasswordSet){ @@ -258,42 +252,36 @@ _settingsHome.notificationText = "" } onConfirmClicked: { + isPassword_Accepted = false + let password = _servicePassword.password if ( !isDefaultPasswordSet ) { - let password = _servicePassword.password let passwordReEntry = _servicePassword.passwordReEntry - if (password == passwordReEntry) { - if(vSettings.isPasswordConforming(password)) { - vSettings.servicePass = vSettings.encryptString(password) - } else { - _servicePassword.title = qsTr("Malformed Password Entry") - } - } else { - _servicePassword.title = qsTr("Mismatched Password Entry") - } - clearPassword() + if ( password != passwordReEntry ) { _servicePassword.notificationText = qsTr("Mismatched Password Entry"); return } + if (!vSettings.isPasswordValid(password)) { _servicePassword.notificationText = qsTr("Malformed Password Entry" ); return } + + vSettings.updatePassword(password) + _servicePassword.isPassword_Accepted = true + _servicePassword.notificationText = "" clearPasswordReEntry() } else { - if ( vSettings.encryptString(password) === vSettings.servicePass ) { - _settingsHome.notificationText = "" - vAdjustmentServiceMode.doAdjustment() - if ( vSettings.noCANBus ) { // if NoCANBus is set don't wait for HD and go to service mode. - gotoServiceMode(true) - } - clearPassword() - clearPasswordReEntry() - pop() + if (!vSettings.isPasswordMatch(password)) { _servicePassword.notificationText = qsTr("Incorrect service password"); return } + + _servicePassword.isPassword_Accepted = true + _servicePassword.notificationText = "" + vAdjustmentServiceMode.doAdjustment() + if ( vSettings.noCANBus ) { // if NoCANBus is set don't wait for HD and go to service mode. + gotoServiceMode(true) } - else { - _settingsHome.notificationText = qsTr("Incorrect service password") - } } + clearPassword() + pop() // pop back to settings screen and wait for the HD-OpMode change to Service_Mode to update the settings screen. } } Connections { target: vAdjustmentServiceMode function onAdjustmentTriggered ( vValue ) { - if ( vAdjustmentServiceMode.adjustment_Accepted ) { - _settingsHome.notificationText = "" + if ( vAdjustmentServiceMode.adjustment_Accepted ) { + _settingsHome.notificationText = "" } else { _settingsHome.notificationText = vAdjustmentServiceMode.text() @@ -302,7 +290,7 @@ } function gotoServiceMode( vservice ) { -// push( _settingsHome , vservice ) + if ( ! _servicePassword.isPassword_Accepted ) return serviceMode = vservice if ( vservice ) _mainMenu.hidden = true