From 699fe0df63168073016bc23c0f1cc22bb8a7d35a Mon Sep 17 00:00:00 2001 From: JC Brand Date: Mon, 3 Jun 2019 09:25:01 +0200 Subject: [PATCH] Initial support for the CredentialsContainer web API --- CHANGES.md | 1 + src/headless/converse-core.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index ebcfaf7c8..18edb5202 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ # Changelog ## 5.0.0 (Unreleased) +- Initial support for the [CredentialsContainer](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer) web API - Allow for synchronous events. When a synchronous event is fired, Converse will wait for all promises returned by the event's handlers to finish before continuing. - Properly handle message correction being received before the corrected message diff --git a/src/headless/converse-core.js b/src/headless/converse-core.js index 6ae2aa597..522ade45c 100644 --- a/src/headless/converse-core.js +++ b/src/headless/converse-core.js @@ -1346,6 +1346,12 @@ _converse.initialize = async function (settings, callback) { } } else if (reconnecting) { this.autoLogin(); + } else if (window.PasswordCredential) { + const creds = await navigator.credentials.get({'password': true}); + if (creds && creds.type == 'password' && u.isValidJID(creds.id)) { + setUserJID(creds.id); + this.autoLogin({'jid': creds.id, 'password': creds.password}); + } } };