1
0

qml: explicitly use None when empty string is used as password

backend requires None, Qt5 passes empty string
This commit is contained in:
Sander van Grieken
2023-02-28 14:49:08 +01:00
parent 7e84aed9c2
commit c7cb2fb9e6
2 changed files with 15 additions and 2 deletions

View File

@@ -710,14 +710,20 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
@pyqtSlot(str)
def set_password(self, password):
if password == '':
password = None
storage = self.wallet.storage
# HW wallet not supported yet
if storage.is_encrypted_with_hw_device():
return
current_password = self.password if self.password != '' else None
try:
self.wallet.update_password(self.password, password, encrypt_storage=True)
self._logger.info(f'PW change from {current_password} to {password}')
self.wallet.update_password(current_password, password, encrypt_storage=True)
self.password = password
except InvalidPassword as e:
self._logger.exception(repr(e))