mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
Enforce password is filled in if "set user" is checked even when not using SSH
Also fix logic for persisting wheter SSH is enabled.
This commit is contained in:
parent
9c22346d61
commit
0f6115e3a5
1 changed files with 20 additions and 13 deletions
|
@ -144,12 +144,15 @@ Popup {
|
||||||
if (!radioPasswordAuthentication.checked && !radioPubKeyAuthentication.checked) {
|
if (!radioPasswordAuthentication.checked && !radioPubKeyAuthentication.checked) {
|
||||||
radioPasswordAuthentication.checked = true
|
radioPasswordAuthentication.checked = true
|
||||||
}
|
}
|
||||||
if (radioPasswordAuthentication.checked && !fieldUserPassword.length) {
|
if (radioPasswordAuthentication.checked) {
|
||||||
|
chkSetUser.checked = true
|
||||||
|
if (!fieldUserPassword.length) {
|
||||||
fieldUserPassword.forceActiveFocus()
|
fieldUserPassword.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
enabled: chkSSH.checked
|
enabled: chkSSH.checked
|
||||||
Layout.leftMargin: 40
|
Layout.leftMargin: 40
|
||||||
|
@ -394,13 +397,13 @@ Popup {
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("SAVE")
|
text: qsTr("SAVE")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (chkSSH.checked && radioPasswordAuthentication.checked && fieldUserPassword.text.length == 0)
|
if (chkSetUser.checked && fieldUserPassword.text.length == 0)
|
||||||
{
|
{
|
||||||
fieldUserPassword.indicateError = true
|
fieldUserPassword.indicateError = true
|
||||||
fieldUserPassword.forceActiveFocus()
|
fieldUserPassword.forceActiveFocus()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (chkSSH.checked && fieldUserName.text.length == 0)
|
if (chkSetUser.checked && fieldUserName.text.length == 0)
|
||||||
{
|
{
|
||||||
fieldUserName.indicateError = true
|
fieldUserName.indicateError = true
|
||||||
fieldUserName.forceActiveFocus()
|
fieldUserName.forceActiveFocus()
|
||||||
|
@ -463,9 +466,13 @@ Popup {
|
||||||
if ('sshUserPassword' in settings) {
|
if ('sshUserPassword' in settings) {
|
||||||
fieldUserPassword.text = settings.sshUserPassword
|
fieldUserPassword.text = settings.sshUserPassword
|
||||||
fieldUserPassword.alreadyCrypted = true
|
fieldUserPassword.alreadyCrypted = true
|
||||||
|
chkSetUser.checked = true
|
||||||
|
/* Older imager versions did not have a sshEnabled setting.
|
||||||
|
Assume it is true if it does not exists and sshUserPassword is set */
|
||||||
|
if (!('sshEnabled' in settings) || settings.sshEnabled === "true") {
|
||||||
chkSSH.checked = true
|
chkSSH.checked = true
|
||||||
radioPasswordAuthentication.checked = true
|
radioPasswordAuthentication.checked = true
|
||||||
chkSetUser.checked = true
|
}
|
||||||
}
|
}
|
||||||
if ('sshUserName' in settings) {
|
if ('sshUserName' in settings) {
|
||||||
fieldUserName.text = settings.sshUserName
|
fieldUserName.text = settings.sshUserName
|
||||||
|
@ -779,15 +786,15 @@ Popup {
|
||||||
if (chkHostname.checked && fieldHostname.length) {
|
if (chkHostname.checked && fieldHostname.length) {
|
||||||
settings.hostname = fieldHostname.text
|
settings.hostname = fieldHostname.text
|
||||||
}
|
}
|
||||||
if (chkSSH.checked) {
|
if (chkSetUser.checked) {
|
||||||
settings.sshUserName = fieldUserName.text
|
settings.sshUserName = fieldUserName.text
|
||||||
if (radioPasswordAuthentication.checked) {
|
|
||||||
settings.sshUserPassword = fieldUserPassword.alreadyCrypted ? fieldUserPassword.text : imageWriter.crypt(fieldUserPassword.text)
|
settings.sshUserPassword = fieldUserPassword.alreadyCrypted ? fieldUserPassword.text : imageWriter.crypt(fieldUserPassword.text)
|
||||||
}
|
}
|
||||||
if (radioPubKeyAuthentication.checked) {
|
|
||||||
|
settings.sshEnabled = chkSSH.checked
|
||||||
|
if (chkSSH.checked && radioPubKeyAuthentication.checked) {
|
||||||
settings.sshAuthorizedKeys = fieldPublicKey.text
|
settings.sshAuthorizedKeys = fieldPublicKey.text
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (chkWifi.checked) {
|
if (chkWifi.checked) {
|
||||||
settings.wifiSSID = fieldWifiSSID.text
|
settings.wifiSSID = fieldWifiSSID.text
|
||||||
settings.wifiSSIDHidden = chkWifiSSIDHidden.checked
|
settings.wifiSSIDHidden = chkWifiSSIDHidden.checked
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue