Thu, 06 Sep 2018 19:34:49 +0200
MqttClient, MqttConnectionOptionsDialog: added support for encrypted passwords.
MqttMonitor/MqttClient.py | file | annotate | diff | comparison | revisions | |
MqttMonitor/MqttConnectionOptionsDialog.py | file | annotate | diff | comparison | revisions |
--- a/MqttMonitor/MqttClient.py Thu Sep 06 19:33:51 2018 +0200 +++ b/MqttMonitor/MqttClient.py Thu Sep 06 19:34:49 2018 +0200 @@ -13,6 +13,8 @@ import paho.mqtt.client as mqtt +from Utilities.crypto import pwConvert + class MqttClient(QObject): """ @@ -226,8 +228,9 @@ # step 2: set username and password if parametersDict["Username"]: if parametersDict["Password"]: - self.setUserCredentials(parametersDict["Username"], - parametersDict["Password"]) + self.setUserCredentials( + parametersDict["Username"], + pwConvert(parametersDict["Password"], encode=False)) else: self.setUserCredentials(parametersDict["Username"])
--- a/MqttMonitor/MqttConnectionOptionsDialog.py Thu Sep 06 19:33:51 2018 +0200 +++ b/MqttMonitor/MqttConnectionOptionsDialog.py Thu Sep 06 19:34:49 2018 +0200 @@ -16,6 +16,8 @@ from .Ui_MqttConnectionOptionsDialog import Ui_MqttConnectionOptionsDialog +from Utilities.crypto import pwConvert + class MqttConnectionOptionsDialog(QDialog, Ui_MqttConnectionOptionsDialog): """ @@ -102,7 +104,7 @@ # user credentials self.usernameEdit.setText(options["Username"]) - self.passwordEdit.setText(options["Password"]) + self.passwordEdit.setText(pwConvert(options["Password"], encode=False)) # last will and testament self.willQosSpinBox.setValue(options["WillQos"]) @@ -124,7 +126,7 @@ "Keepalive": self.keepaliveSpinBox.value(), "CleanSession": self.cleanSessionCheckBox.isChecked(), "Username": self.usernameEdit.text(), - "Password": self.passwordEdit.text(), + "Password": pwConvert(self.passwordEdit.text(), encode=True), "WillTopic": self.willTopicEdit.text(), "WillMessage": self.willMessageEdit.toPlainText(), "WillQos": self.willQosSpinBox.value(),