Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -rf2656247b7f73e4c2494605af2f7bdbbd26f776f -r09a43d162e61ae02c73364e050d90957d736f322 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision f2656247b7f73e4c2494605af2f7bdbbd26f776f) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 09a43d162e61ae02c73364e050d90957d736f322) @@ -237,38 +237,56 @@ } UserConfirmation { id: _servicePassword + property bool isDefaultPasswordSet : (vSettings.servicePass != "") + itemIndex : SettingsStack.Services title : qsTr("Service Password") isPassword: true + showPasswordReEntryField: !isDefaultPasswordSet onVisibleChanged: { - // TODO check for if password is set already if (visible) { - // check password with cpp. Open file and check + if (!isDefaultPasswordSet) { + _servicePassword.title = qsTr("Default Service Password") + } } } onBackClicked : { clearPassword() + if(!isDefaultPasswordSet){ + clearPasswordReEntry() + } _settingsHome.notificationText = "" } onConfirmClicked: { - // DEBUG console.log(vSettings.isPasswordConforming(password)) - if ( vSettings.servicePass === "" ) { - _settingsHome.notificationText = qsTr("No service password defined") - } - else { - if ( password === vSettings.servicePass ) { + 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() + 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() } else { _settingsHome.notificationText = qsTr("Incorrect service password") } } - clearPassword() - pop() } }