Prechádzať zdrojové kódy

Update to Strophe 1.2.8 and add support for SASL-EXTERNAL auth

JC Brand 8 rokov pred
rodič
commit
713922a9e1

+ 0 - 1
bower.json

@@ -15,7 +15,6 @@
     "bootstrap": "~3.2.0",
     "fontawesome": "~4.1.0",
     "typeahead.js": "https://raw.githubusercontent.com/jcbrand/typeahead.js/eedfb10505dd3a20123d1fafc07c1352d83f0ab3/dist/typeahead.jquery.js",
-    "strophejs": "1.2.7",
     "strophejs-plugins": "https://github.com/strophe/strophejs-plugins.git#amd",
     "bourbon": "~4.2.6"
   },

+ 9 - 9
config.js

@@ -25,15 +25,15 @@ require.config({
         "jquery.easing":            "components/jquery-easing-original/index",          // XXX: Only required for https://conversejs.org website
         "moment":                   "node_modules/moment/moment",
         "pluggable":                "node_modules/pluggable.js/pluggable",
-        "strophe":                  "components/strophejs/src/wrapper",
-        "strophe-base64":           "components/strophejs/src/base64",
-        "strophe-bosh":             "components/strophejs/src/bosh",
-        "strophe-core":             "components/strophejs/src/core",
-        "strophe-md5":              "components/strophejs/src/md5",
-        "strophe-polyfill":         "components/strophejs/src/polyfills",
-        "strophe-sha1":             "components/strophejs/src/sha1",
-        "strophe-utils":            "components/strophejs/src/utils",
-        "strophe-websocket":        "components/strophejs/src/websocket",
+        "strophe":                  "node_modules/strophe.js/src/wrapper",
+        "strophe-base64":           "node_modules/strophe.js/src/base64",
+        "strophe-bosh":             "node_modules/strophe.js/src/bosh",
+        "strophe-core":             "node_modules/strophe.js/src/core",
+        "strophe-md5":              "node_modules/strophe.js/src/md5",
+        "strophe-polyfill":         "node_modules/strophe.js/src/polyfills",
+        "strophe-sha1":             "node_modules/strophe.js/src/sha1",
+        "strophe-utils":            "node_modules/strophe.js/src/utils",
+        "strophe-websocket":        "node_modules/strophe.js/src/websocket",
         "strophe.disco":            "components/strophejs-plugins/disco/strophe.disco",
         "strophe.ping":             "src/strophe.ping",
         "strophe.rsm":              "components/strophejs-plugins/rsm/strophe.rsm",

+ 1 - 0
docs/CHANGES.md

@@ -8,6 +8,7 @@
 - Hardcode the storage for roster contacts and chatroom occupants to `sessionStorage`. [jcbrand]
 - Fixed wrong chat state value, should be `chat`, not `chatty`.
   See [RFC 3921](https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.1.2.2). [jcbrand]
+- Adds support for SASL-EXTERNAL. [jcbrand]
 
 ## 1.0.6 (2016-08-12)
 - #632 Offline and Logout states do not properly update once users start

+ 9 - 8
package.json

@@ -45,18 +45,19 @@
     "po2json": "^0.3.0"
   },
   "dependencies": {
-    "requirejs": "~2.2.0",
-    "pluggable.js": "0.0.2",
-    "jquery": "1.12.3",
-    "jed": "0.5.4",
-    "underscore": "~1.8.3",
+    "almond": "~0.3.1",
     "backbone": "1.1.2",
     "backbone.browserStorage": "0.0.3",
     "backbone.overview": "0.0.2",
-    "otr": "0.2.16",
     "crypto-js-evanvosberg": "https://github.com/evanvosberg/crypto-js.git#release-3.1.2-5",
-    "almond": "~0.3.1",
+    "jed": "0.5.4",
+    "jquery": "1.12.3",
+    "jquery.browser": ">=0.1.0",
     "moment": "~2.12.0",
-    "jquery.browser": ">=0.1.0"
+    "otr": "0.2.16",
+    "pluggable.js": "0.0.2",
+    "requirejs": "~2.2.0",
+    "strophe.js": "1.2.8",
+    "underscore": "~1.8.3"
   }
 }

+ 4 - 3
src/converse-controlbox.js

@@ -368,8 +368,9 @@
                 initialize: function (cfg) {
                     cfg.$parent.html(this.$el.html(
                         converse.templates.login_panel({
-                            'LOGIN': converse.LOGIN,
                             'ANONYMOUS': converse.ANONYMOUS,
+                            'EXTERNAL': converse.EXTERNAL,
+                            'LOGIN': converse.LOGIN,
                             'PREBIND': converse.PREBIND,
                             'auto_login': converse.auto_login,
                             'authentication': converse.authentication,
@@ -406,11 +407,11 @@
                         password = $pw_input.val(),
                         errors = false;
 
-                    if (! jid) {
+                    if (!jid) {
                         errors = true;
                         $jid_input.addClass('error');
                     }
-                    if (! password)  {
+                    if (!password && converse.authentication !== converse.EXTERNAL)  {
                         errors = true;
                         $pw_input.addClass('error');
                     }

+ 5 - 4
src/converse-core.js

@@ -94,12 +94,13 @@
         'chat':         1, // We currently don't differentiate between "chat" and "online"
         'online':       1
     };
+    converse.ANONYMOUS  = "anonymous";
+    converse.CLOSED = 'closed';
+    converse.EXTERNAL = "external";
     converse.LOGIN = "login";
     converse.LOGOUT = "logout";
-    converse.ANONYMOUS  = "anonymous";
-    converse.PREBIND = "prebind";
     converse.OPENED = 'opened';
-    converse.CLOSED = 'closed';
+    converse.PREBIND = "prebind";
 
     var PRETTY_CONNECTION_STATUS = {
         0: 'ERROR',
@@ -214,7 +215,7 @@
         this.default_settings = {
             allow_contact_requests: true,
             animate: true,
-            authentication: 'login', // Available values are "login", "prebind", "anonymous".
+            authentication: 'login', // Available values are "login", "prebind", "anonymous" and "external".
             auto_away: 0, // Seconds after which user status is set to 'away'
             auto_login: false, // Currently only used in connection with anonymous login
             auto_reconnect: false,

+ 5 - 3
src/templates/login_panel.html

@@ -3,11 +3,13 @@
         <span class="spinner login-submit"/>
     {[ } ]}
     {[ if (!auto_login) { ]}
-        {[ if (authentication == LOGIN) { ]}
+        {[ if (authentication == LOGIN || authentication == EXTERNAL) { ]}
             <label>{{label_username}}</label>
             <input type="text" name="jid" placeholder="{{placeholder_username}}">
-            <label>{{label_password}}</label>
-            <input type="password" name="password" placeholder="{{placeholder_password}}">
+            {[ if (authentication !== EXTERNAL) { ]}
+                <label>{{label_password}}</label>
+                <input type="password" name="password" placeholder="{{placeholder_password}}">
+            {[ } ]}
             <input class="pure-button button-primary" type="submit" value="{{label_login}}">
             <span class="conn-feedback"></span>
         {[ } ]}