30 self.__oldPasswordHash = oldPasswordHash |
30 self.__oldPasswordHash = oldPasswordHash |
31 if self.__oldPasswordHash == "": |
31 if self.__oldPasswordHash == "": |
32 self.currentPasswordEdit.setEnabled(False) |
32 self.currentPasswordEdit.setEnabled(False) |
33 if hasattr(self.currentPasswordEdit, "setPlaceholderText"): |
33 if hasattr(self.currentPasswordEdit, "setPlaceholderText"): |
34 self.currentPasswordEdit.setPlaceholderText( |
34 self.currentPasswordEdit.setPlaceholderText( |
35 self.trUtf8("(not defined yet)")) |
35 self.tr("(not defined yet)")) |
36 |
36 |
37 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
37 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
38 |
38 |
39 def __updateUI(self): |
39 def __updateUI(self): |
40 """ |
40 """ |
45 if self.currentPasswordEdit.isEnabled(): |
45 if self.currentPasswordEdit.isEnabled(): |
46 from Utilities.crypto.py3PBKDF2 import verifyPassword |
46 from Utilities.crypto.py3PBKDF2 import verifyPassword |
47 enable = verifyPassword( |
47 enable = verifyPassword( |
48 self.currentPasswordEdit.text(), self.__oldPasswordHash) |
48 self.currentPasswordEdit.text(), self.__oldPasswordHash) |
49 if not enable: |
49 if not enable: |
50 error = error or self.trUtf8("Wrong password entered.") |
50 error = error or self.tr("Wrong password entered.") |
51 |
51 |
52 if self.newPasswordEdit.text() == "": |
52 if self.newPasswordEdit.text() == "": |
53 enable = False |
53 enable = False |
54 error = error or self.trUtf8("New password must not be empty.") |
54 error = error or self.tr("New password must not be empty.") |
55 |
55 |
56 if self.newPasswordEdit.text() != "" and \ |
56 if self.newPasswordEdit.text() != "" and \ |
57 self.newPasswordEdit.text() != self.newPasswordAgainEdit.text(): |
57 self.newPasswordEdit.text() != self.newPasswordAgainEdit.text(): |
58 enable = False |
58 enable = False |
59 error = error or self.trUtf8("Repeated password is wrong.") |
59 error = error or self.tr("Repeated password is wrong.") |
60 |
60 |
61 if self.currentPasswordEdit.isEnabled(): |
61 if self.currentPasswordEdit.isEnabled(): |
62 if self.newPasswordEdit.text() == self.currentPasswordEdit.text(): |
62 if self.newPasswordEdit.text() == self.currentPasswordEdit.text(): |
63 enable = False |
63 enable = False |
64 error = error or \ |
64 error = error or \ |
65 self.trUtf8("Old and new password must not be the same.") |
65 self.tr("Old and new password must not be the same.") |
66 |
66 |
67 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
67 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
68 self.errorLabel.setText(error) |
68 self.errorLabel.setText(error) |
69 |
69 |
70 @pyqtSlot(str) |
70 @pyqtSlot(str) |