mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
nm: enterprise options for domain and realm
This commit is contained in:
@@ -12,10 +12,19 @@ DankModal {
|
|||||||
property string wifiUsernameInput: ""
|
property string wifiUsernameInput: ""
|
||||||
property bool requiresEnterprise: false
|
property bool requiresEnterprise: false
|
||||||
|
|
||||||
|
property string wifiRealmInput: ""
|
||||||
|
property bool wifiUseAtRealm: true
|
||||||
|
property string wifiAnonymousIdentityInput: ""
|
||||||
|
property string wifiDomainSuffixMatchInput: ""
|
||||||
|
|
||||||
function show(ssid) {
|
function show(ssid) {
|
||||||
wifiPasswordSSID = ssid
|
wifiPasswordSSID = ssid
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
wifiRealmInput = ""
|
||||||
|
wifiUseAtRealm = true
|
||||||
|
wifiAnonymousIdentityInput = ""
|
||||||
|
wifiDomainSuffixMatchInput = ""
|
||||||
|
|
||||||
const network = NetworkService.wifiNetworks.find(n => n.ssid === ssid)
|
const network = NetworkService.wifiNetworks.find(n => n.ssid === ssid)
|
||||||
requiresEnterprise = network?.enterprise || false
|
requiresEnterprise = network?.enterprise || false
|
||||||
@@ -34,11 +43,15 @@ DankModal {
|
|||||||
|
|
||||||
shouldBeVisible: false
|
shouldBeVisible: false
|
||||||
width: 420
|
width: 420
|
||||||
height: requiresEnterprise ? 310 : 230
|
height: requiresEnterprise ? 520 : 230
|
||||||
onShouldBeVisibleChanged: () => {
|
onShouldBeVisibleChanged: () => {
|
||||||
if (!shouldBeVisible) {
|
if (!shouldBeVisible) {
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
wifiRealmInput = ""
|
||||||
|
wifiUseAtRealm = true
|
||||||
|
wifiAnonymousIdentityInput = ""
|
||||||
|
wifiDomainSuffixMatchInput = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onOpened: {
|
onOpened: {
|
||||||
@@ -56,6 +69,10 @@ DankModal {
|
|||||||
close()
|
close()
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
wifiRealmInput = ""
|
||||||
|
wifiUseAtRealm = true
|
||||||
|
wifiAnonymousIdentityInput = ""
|
||||||
|
wifiDomainSuffixMatchInput = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@@ -84,6 +101,10 @@ DankModal {
|
|||||||
close()
|
close()
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
wifiRealmInput = ""
|
||||||
|
wifiUseAtRealm = true
|
||||||
|
wifiAnonymousIdentityInput = ""
|
||||||
|
wifiDomainSuffixMatchInput = ""
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,10 +217,22 @@ DankModal {
|
|||||||
}
|
}
|
||||||
onAccepted: () => {
|
onAccepted: () => {
|
||||||
const username = requiresEnterprise ? usernameInput.text : ""
|
const username = requiresEnterprise ? usernameInput.text : ""
|
||||||
NetworkService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
NetworkService.connectToWifi(
|
||||||
|
wifiPasswordSSID,
|
||||||
|
passwordInput.text,
|
||||||
|
username,
|
||||||
|
wifiRealmInput,
|
||||||
|
wifiUseAtRealm,
|
||||||
|
wifiAnonymousIdentityInput,
|
||||||
|
wifiDomainSuffixMatchInput
|
||||||
|
)
|
||||||
close()
|
close()
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
wifiRealmInput = ""
|
||||||
|
wifiUseAtRealm = true
|
||||||
|
wifiAnonymousIdentityInput = ""
|
||||||
|
wifiDomainSuffixMatchInput = ""
|
||||||
passwordInput.text = ""
|
passwordInput.text = ""
|
||||||
if (requiresEnterprise) usernameInput.text = ""
|
if (requiresEnterprise) usernameInput.text = ""
|
||||||
}
|
}
|
||||||
@@ -235,6 +268,164 @@ DankModal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
visible: requiresEnterprise
|
||||||
|
width: parent.width
|
||||||
|
height: 50
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Theme.surfaceHover
|
||||||
|
border.color: realmInput.activeFocus ? Theme.primary : Theme.outlineStrong
|
||||||
|
border.width: realmInput.activeFocus ? 2 : 1
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: () => {
|
||||||
|
realmInput.forceActiveFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: realmInput
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
textColor: Theme.surfaceText
|
||||||
|
text: wifiRealmInput
|
||||||
|
placeholderText: "Realm / Domain (optional)"
|
||||||
|
backgroundColor: "transparent"
|
||||||
|
enabled: root.shouldBeVisible
|
||||||
|
onTextEdited: () => {
|
||||||
|
wifiRealmInput = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
visible: requiresEnterprise
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
width: parent.width
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: atRealmBtn
|
||||||
|
|
||||||
|
height: 36
|
||||||
|
width: (parent.width - Theme.spacingM) / 2
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: wifiUseAtRealm ? Theme.primary : Theme.surfaceHover
|
||||||
|
border.color: wifiUseAtRealm ? Theme.primary : Theme.outlineStrong
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: () => {
|
||||||
|
wifiUseAtRealm = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "username@realm"
|
||||||
|
color: wifiUseAtRealm ? Theme.background : Theme.surfaceText
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: domainSlashBtn
|
||||||
|
|
||||||
|
height: 36
|
||||||
|
width: (parent.width - Theme.spacingM) / 2
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: !wifiUseAtRealm ? Theme.primary : Theme.surfaceHover
|
||||||
|
border.color: !wifiUseAtRealm ? Theme.primary : Theme.outlineStrong
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: () => {
|
||||||
|
wifiUseAtRealm = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "DOMAIN\\username"
|
||||||
|
color: !wifiUseAtRealm ? Theme.background : Theme.surfaceText
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
visible: requiresEnterprise
|
||||||
|
width: parent.width
|
||||||
|
height: 50
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Theme.surfaceHover
|
||||||
|
border.color: anonInput.activeFocus ? Theme.primary : Theme.outlineStrong
|
||||||
|
border.width: anonInput.activeFocus ? 2 : 1
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: () => {
|
||||||
|
anonInput.forceActiveFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: anonInput
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
textColor: Theme.surfaceText
|
||||||
|
text: wifiAnonymousIdentityInput
|
||||||
|
placeholderText: "Anonymous Identity (optional)"
|
||||||
|
backgroundColor: "transparent"
|
||||||
|
enabled: root.shouldBeVisible
|
||||||
|
onTextEdited: () => {
|
||||||
|
wifiAnonymousIdentityInput = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
visible: requiresEnterprise
|
||||||
|
width: parent.width
|
||||||
|
height: 50
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Theme.surfaceHover
|
||||||
|
border.color: domainMatchInput.activeFocus ? Theme.primary : Theme.outlineStrong
|
||||||
|
border.width: domainMatchInput.activeFocus ? 2 : 1
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: () => {
|
||||||
|
domainMatchInput.forceActiveFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: domainMatchInput
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
textColor: Theme.surfaceText
|
||||||
|
text: wifiDomainSuffixMatchInput
|
||||||
|
placeholderText: "Server Domain for certificate (optional)"
|
||||||
|
backgroundColor: "transparent"
|
||||||
|
enabled: root.shouldBeVisible
|
||||||
|
onTextEdited: () => {
|
||||||
|
wifiDomainSuffixMatchInput = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
@@ -313,6 +504,10 @@ DankModal {
|
|||||||
close()
|
close()
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
wifiRealmInput = ""
|
||||||
|
wifiUseAtRealm = true
|
||||||
|
wifiAnonymousIdentityInput = ""
|
||||||
|
wifiDomainSuffixMatchInput = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,10 +539,22 @@ DankModal {
|
|||||||
enabled: parent.enabled
|
enabled: parent.enabled
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
const username = requiresEnterprise ? usernameInput.text : ""
|
const username = requiresEnterprise ? usernameInput.text : ""
|
||||||
NetworkService.connectToWifi(wifiPasswordSSID, passwordInput.text, username)
|
NetworkService.connectToWifi(
|
||||||
|
wifiPasswordSSID,
|
||||||
|
passwordInput.text,
|
||||||
|
username,
|
||||||
|
wifiRealmInput,
|
||||||
|
wifiUseAtRealm,
|
||||||
|
wifiAnonymousIdentityInput,
|
||||||
|
wifiDomainSuffixMatchInput
|
||||||
|
)
|
||||||
close()
|
close()
|
||||||
wifiPasswordInput = ""
|
wifiPasswordInput = ""
|
||||||
wifiUsernameInput = ""
|
wifiUsernameInput = ""
|
||||||
|
wifiRealmInput = ""
|
||||||
|
wifiUseAtRealm = true
|
||||||
|
wifiAnonymousIdentityInput = ""
|
||||||
|
wifiDomainSuffixMatchInput = ""
|
||||||
passwordInput.text = ""
|
passwordInput.text = ""
|
||||||
if (requiresEnterprise) usernameInput.text = ""
|
if (requiresEnterprise) usernameInput.text = ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ Singleton {
|
|||||||
scanWifi()
|
scanWifi()
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToWifi(ssid, password = "", username = "") {
|
function connectToWifi(ssid, password = "", username = "", realmOrDomain = "", useAtRealm = true, anonymousIdentity = "", domainSuffixMatch = "") {
|
||||||
if (!networkAvailable || isConnecting) return
|
if (!networkAvailable || isConnecting) return
|
||||||
|
|
||||||
isConnecting = true
|
isConnecting = true
|
||||||
@@ -255,6 +255,10 @@ Singleton {
|
|||||||
const params = { ssid: ssid }
|
const params = { ssid: ssid }
|
||||||
if (password) params.password = password
|
if (password) params.password = password
|
||||||
if (username) params.username = username
|
if (username) params.username = username
|
||||||
|
if (realmOrDomain) params.realmOrDomain = realmOrDomain
|
||||||
|
if (username) params.useAtRealm = useAtRealm
|
||||||
|
if (anonymousIdentity) params.anonymousIdentity = anonymousIdentity
|
||||||
|
if (domainSuffixMatch) params.domainSuffixMatch = domainSuffixMatch
|
||||||
|
|
||||||
DMSService.sendRequest("network.wifi.connect", params, response => {
|
DMSService.sendRequest("network.wifi.connect", params, response => {
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
@@ -383,8 +387,8 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToWifiAndSetPreference(ssid, password, username = "") {
|
function connectToWifiAndSetPreference(ssid, password, username = "", realmOrDomain = "", useAtRealm = true, anonymousIdentity = "", domainSuffixMatch = "") {
|
||||||
connectToWifi(ssid, password, username)
|
connectToWifi(ssid, password, username, realmOrDomain, useAtRealm, anonymousIdentity, domainSuffixMatch)
|
||||||
setNetworkPreference("wifi")
|
setNetworkPreference("wifi")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,9 +149,9 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToWifi(ssid, password = "", username = "") {
|
function connectToWifi(ssid, password = "", username = "", realmOrDomain = "", useAtRealm = true, anonymousIdentity = "", domainSuffixMatch = "") {
|
||||||
if (activeService && activeService.connectToWifi) {
|
if (activeService && activeService.connectToWifi) {
|
||||||
activeService.connectToWifi(ssid, password, username)
|
activeService.connectToWifi(ssid, password, username, realmOrDomain, useAtRealm, anonymousIdentity, domainSuffixMatch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,9 +191,9 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToWifiAndSetPreference(ssid, password, username = "") {
|
function connectToWifiAndSetPreference(ssid, password, username = "", realmOrDomain = "", useAtRealm = true, anonymousIdentity = "", domainSuffixMatch = "") {
|
||||||
if (activeService && activeService.connectToWifiAndSetPreference) {
|
if (activeService && activeService.connectToWifiAndSetPreference) {
|
||||||
activeService.connectToWifiAndSetPreference(ssid, password, username)
|
activeService.connectToWifiAndSetPreference(ssid, password, username, realmOrDomain, useAtRealm, anonymousIdentity, domainSuffixMatch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user