diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-09-08 16:19:36 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-09-08 20:10:16 +0200 |
commit | a40434d402ceb9cfacff59aeeab12a3d6b13a0ed (patch) | |
tree | 95521c9e1aa63dcfa0532704a1497cae15a639f8 | |
parent | 6ba46743264ad88132f4492b904b10542842e284 (diff) |
[feat] do not show password field if allowEmptyPass is set
-rw-r--r-- | gui/qml/LoginDialog.qml | 1 | ||||
-rw-r--r-- | gui/qml/main.qml | 21 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gui/qml/LoginDialog.qml b/gui/qml/LoginDialog.qml index 1724769..897081b 100644 --- a/gui/qml/LoginDialog.qml +++ b/gui/qml/LoginDialog.qml @@ -18,6 +18,7 @@ Dialog { id: password placeholderText: qsTr("password") echoMode: TextInput.PasswordEchoOnEdit + visible: !allowEmptyPass } } diff --git a/gui/qml/main.qml b/gui/qml/main.qml index f0a2b5c..f030345 100644 --- a/gui/qml/main.qml +++ b/gui/qml/main.qml @@ -11,6 +11,7 @@ ApplicationWindow { property var ctx property var loginDone + property var allowEmptyPass Connections { target: jsonModel @@ -46,8 +47,20 @@ ApplicationWindow { } function showInitFailure(msg) { - initFailure.text = msg - initFailure.visible = true + initFailure.text = msg + initFailure.visible = true + } + + function shouldAllowEmptyPass() { + let obj = JSON.parse(providers.getJson()) + let active = obj['default'] + let allProviders = obj['providers'] + for (let i = 0; i < allProviders.length; i++) { + if (allProviders[i]['name'] === active) { + return (allProviders[i]['authEmptyPass'] === 'true') + } + } + return false } Component.onCompleted: { @@ -59,9 +72,11 @@ ApplicationWindow { Loaders as a placeholder for all the many dialogs, or to load a nice splash screen etc... */ - console.debug("Pre-seeded providers:"); + console.debug("DEBUG: Pre-seeded providers:"); console.debug(providers.getJson()); + allowEmptyPass = shouldAllowEmptyPass() + app.visible = true; show(); hide(); |