Browse Source

fix(LoginDialog.web): 'states' is passed as undefined

j8
paweldomas 8 years ago
parent
commit
6890414bad
1 changed files with 35 additions and 33 deletions
  1. 35
    33
      modules/UI/authentication/LoginDialog.js

+ 35
- 33
modules/UI/authentication/LoginDialog.js View File

61
         finishedButtons.push(cancelButton());
61
         finishedButtons.push(cancelButton());
62
     }
62
     }
63
 
63
 
64
-    const connDialog = APP.UI.messageHandler.openDialogWithStates(
65
-        states, // eslint-disable-line no-use-before-define
66
-        {
67
-            persistent: true,
68
-            closeText: ''
64
+    const states = {
65
+        connecting: {
66
+            buttons: [],
67
+            defaultButton: 0,
68
+            html: '<div id="connectionStatus"></div>',
69
+            titleKey: 'dialog.connecting'
69
         },
70
         },
70
-        null
71
-    );
71
+        finished: {
72
+            buttons: finishedButtons,
73
+            defaultButton: 0,
74
+            html: '<div id="errorMessage"></div>',
75
+            titleKey: 'dialog.error',
72
 
76
 
73
-    const states = {
77
+            submit(e, v) {
78
+                e.preventDefault();
79
+                if (v === 'retry') {
80
+                    // eslint-disable-next-line no-use-before-define
81
+                    connDialog.goToState('login');
82
+                } else {
83
+                    // User cancelled
84
+                    cancelCallback();
85
+                }
86
+            }
87
+        },
74
         login: {
88
         login: {
75
-            titleKey: 'dialog.passwordRequired',
76
-            html: getPasswordInputHtml(),
77
             buttons: loginButtons,
89
             buttons: loginButtons,
78
             focus: ':input:first',
90
             focus: ':input:first',
79
-            // eslint-disable-next-line max-params
80
-            submit(e, v, m, f) {
91
+            html: getPasswordInputHtml(),
92
+            titleKey: 'dialog.passwordRequired',
93
+
94
+            submit(e, v, m, f) { // eslint-disable-line max-params
81
                 e.preventDefault();
95
                 e.preventDefault();
82
                 if (v) {
96
                 if (v) {
83
                     const jid = f.username;
97
                     const jid = f.username;
84
                     const password = f.password;
98
                     const password = f.password;
85
 
99
 
86
                     if (jid && password) {
100
                     if (jid && password) {
101
+                        // eslint-disable-next-line no-use-before-define
87
                         connDialog.goToState('connecting');
102
                         connDialog.goToState('connecting');
88
                         successCallback(toJid(jid, config.hosts), password);
103
                         successCallback(toJid(jid, config.hosts), password);
89
                     }
104
                     }
92
                     cancelCallback();
107
                     cancelCallback();
93
                 }
108
                 }
94
             }
109
             }
95
-        },
96
-        connecting: {
97
-            titleKey: 'dialog.connecting',
98
-            html: '<div id="connectionStatus"></div>',
99
-            buttons: [],
100
-            defaultButton: 0
101
-        },
102
-        finished: {
103
-            titleKey: 'dialog.error',
104
-            html: '<div id="errorMessage"></div>',
105
-            buttons: finishedButtons,
106
-            defaultButton: 0,
107
-            submit(e, v) {
108
-                e.preventDefault();
109
-                if (v === 'retry') {
110
-                    connDialog.goToState('login');
111
-                } else {
112
-                    // User cancelled
113
-                    cancelCallback();
114
-                }
115
-            }
116
         }
110
         }
117
     };
111
     };
112
+    const connDialog = APP.UI.messageHandler.openDialogWithStates(
113
+        states,
114
+        {
115
+            closeText: '',
116
+            persistent: true
117
+        },
118
+        null
119
+    );
118
 
120
 
119
     /**
121
     /**
120
      * Displays error message in 'finished' state which allows either to cancel
122
      * Displays error message in 'finished' state which allows either to cancel

Loading…
Cancel
Save