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