From 713922a9e1f3c185cecd201b56d6e2cc7fc69d1e Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 16 Sep 2016 13:06:52 +0200 Subject: [PATCH] Update to Strophe 1.2.8 and add support for SASL-EXTERNAL auth --- bower.json | 1 - config.js | 18 +++++++++--------- docs/CHANGES.md | 1 + package.json | 17 +++++++++-------- src/converse-controlbox.js | 7 ++++--- src/converse-core.js | 9 +++++---- src/templates/login_panel.html | 8 +++++--- 7 files changed, 33 insertions(+), 28 deletions(-) diff --git a/bower.json b/bower.json index 9cc056dfe..a073a448b 100644 --- a/bower.json +++ b/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" }, diff --git a/config.js b/config.js index 4657ac72d..ce9894089 100644 --- a/config.js +++ b/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", diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 3c0bc5383..0e7a0f47e 100755 --- a/docs/CHANGES.md +++ b/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 diff --git a/package.json b/package.json index 8bdc2d11d..df58d842a 100644 --- a/package.json +++ b/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" } } diff --git a/src/converse-controlbox.js b/src/converse-controlbox.js index fdc1c0f0a..df4397dde 100644 --- a/src/converse-controlbox.js +++ b/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'); } diff --git a/src/converse-core.js b/src/converse-core.js index bf3501be8..78fa41cb3 100755 --- a/src/converse-core.js +++ b/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, diff --git a/src/templates/login_panel.html b/src/templates/login_panel.html index 258b2832c..31fca78cb 100644 --- a/src/templates/login_panel.html +++ b/src/templates/login_panel.html @@ -3,11 +3,13 @@ {[ } ]} {[ if (!auto_login) { ]} - {[ if (authentication == LOGIN) { ]} + {[ if (authentication == LOGIN || authentication == EXTERNAL) { ]} - - + {[ if (authentication !== EXTERNAL) { ]} + + + {[ } ]} {[ } ]}