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