qml: report unified password change failure, impose minimum password length of 5, disallow empty passwords
This commit is contained in:
@@ -74,7 +74,7 @@ ElDialog {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Ok")
|
||||
icon.source: '../../icons/confirmed.png'
|
||||
enabled: confirmPassword ? pw_1.text == pw_2.text : true
|
||||
enabled: confirmPassword ? pw_1.text.length > 4 && pw_1.text == pw_2.text : true
|
||||
onClicked: {
|
||||
password = pw_1.text
|
||||
passworddialog.accept()
|
||||
|
||||
@@ -508,18 +508,23 @@ Pane {
|
||||
app.stack.pop()
|
||||
}
|
||||
function onRequestNewPassword() { // new unified password (all wallets)
|
||||
var dialog = app.passwordDialog.createObject(app,
|
||||
{
|
||||
'confirmPassword': true,
|
||||
'title': qsTr('Enter new password'),
|
||||
'infotext': qsTr('If you forget your password, you\'ll need to\
|
||||
restore from seed. Please make sure you have your seed stored safely')
|
||||
} )
|
||||
var dialog = app.passwordDialog.createObject(app, {
|
||||
confirmPassword: true,
|
||||
title: qsTr('Enter new password'),
|
||||
infotext: qsTr('If you forget your password, you\'ll need to restore from seed. Please make sure you have your seed stored safely')
|
||||
})
|
||||
dialog.accepted.connect(function() {
|
||||
Daemon.setPassword(dialog.password)
|
||||
})
|
||||
dialog.open()
|
||||
}
|
||||
function onPasswordChangeFailed() {
|
||||
var dialog = app.messageDialog.createObject(app, {
|
||||
title: qsTr('Error'),
|
||||
text: qsTr('Password change failed')
|
||||
})
|
||||
dialog.open()
|
||||
}
|
||||
function onWalletDeleteError(code, message) {
|
||||
if (code == 'unpaid_requests') {
|
||||
var dialog = app.messageDialog.createObject(app, {text: message, yesno: true })
|
||||
@@ -544,9 +549,9 @@ Pane {
|
||||
target: Daemon.currentWallet
|
||||
function onRequestNewPassword() { // new wallet password
|
||||
var dialog = app.passwordDialog.createObject(app, {
|
||||
'confirmPassword': true,
|
||||
'title': qsTr('Enter new password'),
|
||||
'infotext': qsTr('If you forget your password, you\'ll need to restore from seed. Please make sure you have your seed stored safely')
|
||||
confirmPassword: true,
|
||||
title: qsTr('Enter new password'),
|
||||
infotext: qsTr('If you forget your password, you\'ll need to restore from seed. Please make sure you have your seed stored safely')
|
||||
})
|
||||
dialog.accepted.connect(function() {
|
||||
Daemon.currentWallet.set_password(dialog.password)
|
||||
|
||||
@@ -127,6 +127,7 @@ class QEDaemon(AuthMixin, QObject):
|
||||
newWalletWizardChanged = pyqtSignal()
|
||||
serverConnectWizardChanged = pyqtSignal()
|
||||
loadingChanged = pyqtSignal()
|
||||
passwordChangeFailed = pyqtSignal()
|
||||
|
||||
walletLoaded = pyqtSignal([str,str], arguments=['name','path'])
|
||||
walletRequiresPassword = pyqtSignal([str,str], arguments=['name','path'])
|
||||
@@ -316,11 +317,10 @@ class QEDaemon(AuthMixin, QObject):
|
||||
@pyqtSlot(str)
|
||||
def setPassword(self, password):
|
||||
assert self._use_single_password
|
||||
# map empty string password to None
|
||||
if password == '':
|
||||
password = None
|
||||
self._logger.debug('about to set password for ALL wallets')
|
||||
self.daemon.update_password_for_directory(old_password=self._password, new_password=password)
|
||||
assert password
|
||||
if not self.daemon.update_password_for_directory(old_password=self._password, new_password=password):
|
||||
self.passwordChangeFailed.emit()
|
||||
return
|
||||
self._password = password
|
||||
|
||||
@pyqtProperty(QENewWalletWizard, notify=newWalletWizardChanged)
|
||||
|
||||
Reference in New Issue
Block a user