fix the message boxes on the return of the password change call
This commit is contained in:
parent
56aca8f2f9
commit
ea3f8b7d34
|
@ -105,7 +105,8 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
|
||||||
},
|
},
|
||||||
|
|
||||||
onPasswordChange: function() {
|
onPasswordChange: function() {
|
||||||
if (this.newPassword.getValue() != this.confirmPassword.getValue()) {
|
var newPassword = this.newPassword.getValue();
|
||||||
|
if (newPassword != this.confirmPassword.getValue()) {
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
title: _('Invalid Password'),
|
title: _('Invalid Password'),
|
||||||
msg: _('Your passwords don\'t match!'),
|
msg: _('Your passwords don\'t match!'),
|
||||||
|
@ -117,9 +118,10 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Deluge.Client.auth.change_password(this.oldPassword.getValue(), this.newPassword.getValue(), {
|
var oldPassword = this.oldPassword.getValue();
|
||||||
|
Deluge.Client.auth.change_password(oldPassword, newPassword, {
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result) {
|
if (!result) {
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
title: _('Password'),
|
title: _('Password'),
|
||||||
msg: _('Your old password was incorrect!'),
|
msg: _('Your old password was incorrect!'),
|
||||||
|
@ -128,6 +130,7 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
|
||||||
icon: Ext.MessageBox.ERROR,
|
icon: Ext.MessageBox.ERROR,
|
||||||
iconCls: 'x-deluge-icon-error'
|
iconCls: 'x-deluge-icon-error'
|
||||||
});
|
});
|
||||||
|
this.oldPassword.setValue('');
|
||||||
} else {
|
} else {
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
title: _('Change Successful'),
|
title: _('Change Successful'),
|
||||||
|
@ -137,8 +140,12 @@ Ext.deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
|
||||||
icon: Ext.MessageBox.INFO,
|
icon: Ext.MessageBox.INFO,
|
||||||
iconCls: 'x-deluge-icon-info'
|
iconCls: 'x-deluge-icon-info'
|
||||||
});
|
});
|
||||||
|
this.oldPassword.setValue('');
|
||||||
|
this.newPassword.setValue('');
|
||||||
|
this.confirmPassword.setValue('');
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
scope: this
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue