Color password field red if user enabled SSH but forget password

Ref #188
This commit is contained in:
Floris Bos 2021-03-27 11:04:13 +01:00
parent 91cb44d46e
commit c67cd9bb19

View file

@ -169,13 +169,14 @@ Popup {
Text { Text {
text: qsTr("Set password for 'pi' user:") text: qsTr("Set password for 'pi' user:")
color: parent.enabled ? "black" : "grey" color: parent.enabled ? (fieldUserPassword.indicateError ? "red" : "black") : "grey"
} }
TextField { TextField {
id: fieldUserPassword id: fieldUserPassword
echoMode: TextInput.Password echoMode: TextInput.Password
Layout.minimumWidth: 200 Layout.minimumWidth: 200
property bool alreadyCrypted: false property bool alreadyCrypted: false
property bool indicateError: false
onTextEdited: { onTextEdited: {
if (alreadyCrypted) { if (alreadyCrypted) {
@ -184,6 +185,9 @@ Popup {
alreadyCrypted = false alreadyCrypted = false
clear() clear()
} }
if (indicateError) {
indicateError = false
}
} }
} }
} }
@ -341,8 +345,9 @@ Popup {
Button { Button {
text: qsTr("SAVE") text: qsTr("SAVE")
onClicked: { onClicked: {
if (radioPasswordAuthentication.checked && fieldUserPassword.text.length == 0) if (chkSSH.checked && radioPasswordAuthentication.checked && fieldUserPassword.text.length == 0)
{ {
fieldUserPassword.indicateError = true
fieldUserPassword.forceActiveFocus() fieldUserPassword.forceActiveFocus()
return return
} }