Author: damoxc

Revision: 5685

Log:
        fix the message boxes on the return of the password change call

Diff:
Modified: trunk/deluge/ui/web/js/Deluge.Preferences.Interface.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.Preferences.Interface.js      2009-08-20 
00:05:35 UTC (rev 5684)
+++ trunk/deluge/ui/web/js/Deluge.Preferences.Interface.js      2009-08-20 
00:12:41 UTC (rev 5685)
@@ -105,7 +105,8 @@
        },
        
        onPasswordChange: function() {
-               if (this.newPassword.getValue() != 
this.confirmPassword.getValue()) {
+               var newPassword = this.newPassword.getValue();
+               if (newPassword != this.confirmPassword.getValue()) {
                        Ext.MessageBox.show({
                                title: _('Invalid Password'),
                                msg: _('Your passwords don\'t match!'),
@@ -117,9 +118,10 @@
                        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) {
-                               if (result) {
+                               if (!result) {
                                        Ext.MessageBox.show({
                                                title: _('Password'),
                                                msg: _('Your old password was 
incorrect!'),
@@ -128,6 +130,7 @@
                                                icon: Ext.MessageBox.ERROR,
                                                iconCls: 'x-deluge-icon-error'
                                        });
+                                       this.oldPassword.setValue('');
                                } else {
                                        Ext.MessageBox.show({
                                                title: _('Change Successful'),
@@ -137,8 +140,12 @@
                                                icon: Ext.MessageBox.INFO,
                                                iconCls: 'x-deluge-icon-info'
                                        });
+                                       this.oldPassword.setValue('');
+                                       this.newPassword.setValue('');
+                                       this.confirmPassword.setValue('');
                                }
-                       }
+                       },
+                       scope: this
                });
        },
        



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to