Index: sources/gui/qml/pages/settings/SettingsServicePassword.qml =================================================================== diff -u -rf2e4eba6e85c5d36537be782926f23cc9dc01037 -r6dc7e02773a4823c69b685d8466ea7d58dd320d1 --- sources/gui/qml/pages/settings/SettingsServicePassword.qml (.../SettingsServicePassword.qml) (revision f2e4eba6e85c5d36537be782926f23cc9dc01037) +++ sources/gui/qml/pages/settings/SettingsServicePassword.qml (.../SettingsServicePassword.qml) (revision 6dc7e02773a4823c69b685d8466ea7d58dd320d1) @@ -33,7 +33,7 @@ isPassword : true backVisible : ! _GuiView.manufactSetup passwordChangeMode : isDefaultServicePassword && _GuiView.manufactSetup - title : passwordChangeMode ? qsTr("Set Service Password") : qsTr("Service Password") + title : passwordChangeMode ? qsTr("Set Password") : qsTr("Enter Password") onBackClicked : { clearPasswords() @@ -47,31 +47,45 @@ // if not accepted return if ( ! isPassword_Accepted ) return - // if accepted save the password - if ( passwordChangeMode ) vSettings.updateServicePassword(passwordUpdated) - - // ask HD to go to service mode - vAdjustmentServiceMode.doAdjustment() - // clear the screen _root.notificationText = "" clearPasswords() // go back to the settings home/menu screen + _headerBar.titleText = settingsTitle page(_settingsHome) // in case of debugging that the HD is in service mode already check and call the gotoServiceMode if ( vTDOpMode.service ) gotoServiceMode(true) } function checkPassword() { - if ( ! vSettings.isServicePasswordMatch( passwordCurrent ) ) { _root.notificationText = qsTr("Incorrect password" ); return false } + let servicePasswordCheck = false + let user1PasswordCheck = false // does nothing right now - if ( ! passwordChangeMode ) { _root.notificationText = "" ; return true } + if ( vSettings.isServicePasswordMatch( passwordCurrent ) ) { + if (passwordChangeMode) { + handleServicePassword() + } - if ( passwordConfirm != passwordUpdated ) { _root.notificationText = qsTr("Mismatch Passwords" ); return false } - if ( ! vSettings.isPasswordValid(passwordUpdated ) ) { _root.notificationText = qsTr("Invalid Password" ); return false } + servicePasswordCheck = true + } - _root.notificationText = "" ; return true + // TODO: Add other password match checks for other users +// if ( vSettings.isUser1PasswordMatch( passwordCurrent ) || passwordChangeMode ){ handleUser1Password(); user1PasswordCheck = true } + + // check all password check if any are successful + let allPasswordCheck = servicePasswordCheck || user1PasswordCheck + _root.notificationText = allPasswordCheck ? "" : qsTr("Incorrect password") + + return allPasswordCheck } + + function handleServicePassword() { + // if accepted save the password + if ( passwordChangeMode ) vSettings.updateServicePassword(passwordUpdated) + + // ask TD to go to service mode + vAdjustmentServiceMode.doAdjustment() + } }