44 """ |
44 """ |
45 enable = True |
45 enable = True |
46 error = "" |
46 error = "" |
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 = \ |
49 enable = verifyPassword( |
50 verifyPassword(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.trUtf8("Wrong password entered.") |
53 |
53 |
54 if self.newPasswordEdit.text() == "": |
54 if self.newPasswordEdit.text() == "": |
55 enable = False |
55 enable = False |
61 error = error or self.trUtf8("Repeated password is wrong.") |
61 error = error or self.trUtf8("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 self.trUtf8("Old and new password must not be the same.") |
66 error = error or \ |
|
67 self.trUtf8("Old and new password must not be the same.") |
67 |
68 |
68 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
69 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) |
69 self.errorLabel.setText(error) |
70 self.errorLabel.setText(error) |
70 |
71 |
71 @pyqtSlot(str) |
72 @pyqtSlot(str) |
97 self.__updateUI() |
98 self.__updateUI() |
98 |
99 |
99 def getMasterPassword(self): |
100 def getMasterPassword(self): |
100 """ |
101 """ |
101 Public method to get the new master password. |
102 Public method to get the new master password. |
|
103 |
|
104 @return new master password (string) |
102 """ |
105 """ |
103 return self.newPasswordEdit.text() |
106 return self.newPasswordEdit.text() |
104 |
107 |
105 def getCurrentPassword(self): |
108 def getCurrentPassword(self): |
106 """ |
109 """ |
107 Public method to get the current master password. |
110 Public method to get the current master password. |
|
111 |
|
112 @return current master password (string) |
108 """ |
113 """ |
109 return self.currentPasswordEdit.text() |
114 return self.currentPasswordEdit.text() |