Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion shell/plugins/panels/network/Panel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Panel {
passwordSsid = ""
passwordText = ""
identityText = ""
passwordVisible = false
}

// Live connection details from `ip` / /sys / iw.
Expand Down Expand Up @@ -97,6 +98,7 @@ Panel {
property string passwordSsid: ""
property string passwordText: ""
property string identityText: ""
property bool passwordVisible: false

// ConnectionFailReason values as a plain object, so Model.js helpers stay
// pure JS and Node-testable.
Expand Down Expand Up @@ -688,6 +690,7 @@ Panel {
if (passwordSsid !== ssid) {
passwordText = ""
identityText = ""
passwordVisible = false
}
passwordSsid = ssid
}
Expand Down Expand Up @@ -1863,7 +1866,7 @@ Panel {
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.spacing.rowGap / 2
anchors.rightMargin: Style.space(6)
password: true
password: !root.passwordVisible
placeholderText: "Passphrase"
font.family: Style.font.family
font.pixelSize: Style.font.body
Expand All @@ -1879,6 +1882,23 @@ Panel {

onVisibleChanged: if (visible && !row.isEnterprise) Qt.callLater(forceActiveFocus)
Component.onCompleted: if (visible && !row.isEnterprise) Qt.callLater(forceActiveFocus)

rightPadding: passwordVisibilityBtn.width + Style.spacing.controlGap

PanelActionButton {
id: passwordVisibilityBtn
anchors.right: parent.right
anchors.rightMargin: Style.space(2)
anchors.verticalCenter: parent.verticalCenter
iconText: root.passwordVisible ? "\uf070" : "\uf06e"
tooltipText: root.passwordVisible ? "Hide password" : "Show password"
foreground: root.bar.foreground
fontFamily: root.bar.fontFamily
onClicked: {
root.passwordVisible = !root.passwordVisible
pwField.forceActiveFocus()
}
}
}

BorderSurface {
Expand Down
15 changes: 15 additions & 0 deletions test/shell.d/network-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ const panelSource = fs.readFileSync(root + '/shell/plugins/panels/network/Panel.
assert(/IpcHandler[\s\S]*?function toggleNetwork\(\) \{ root\.toggleNetwork\(\) \}/.test(panelSource), 'network exposes the Wi-Fi radio toggle over IPC')
assert(/manageIpc: false/.test(panelSource), 'network owns its IPC handler so it can extend the target methods')

const passwordField = panelSource.match(/TextField \{\s*id: pwField\b[\s\S]*?\n {6}\}/)
assert(passwordField, 'network has a Wi-Fi passphrase field')
assert(/password: !root\.passwordVisible/.test(passwordField[0]), 'network can reveal the Wi-Fi passphrase')
assert(/id: passwordVisibilityBtn/.test(passwordField[0]), 'network puts a password visibility control inside the passphrase field')
assert(/root\.passwordVisible \? "Hide password" : "Show password"/.test(passwordField[0]), 'network labels both password visibility states')
assert(/root\.passwordVisible = !root\.passwordVisible/.test(passwordField[0]), 'network password visibility control toggles the masked state')

const cancelPasswordPrompt = panelSource.match(/function cancelPasswordPrompt\(\) \{[\s\S]*?\n {2}\}/)
assert(cancelPasswordPrompt, 'network has a passphrase prompt cleanup helper')
assert(/passwordVisible = false/.test(cancelPasswordPrompt[0]), 'network masks the passphrase again when its prompt closes')

const openPasswordPrompt = panelSource.match(/function openPasswordPrompt\(ssid\) \{[\s\S]*?\n {2}\}/)
assert(openPasswordPrompt, 'network has a passphrase prompt opener')
assert(/if \(passwordSsid !== ssid\)[\s\S]*passwordVisible = false/.test(openPasswordPrompt[0]), 'network starts each network passphrase prompt masked')

// Opening from the bar must call open() and nothing else. open() runs
// refresh(true), which defers the PHY scan; a second bare refresh() defaults
// scanWifi to false, sets scannerEnabled synchronously, and stalls the open on
Expand Down