Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
a7184fab
Commit
a7184fab
authored
Jun 05, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Need to wait for setUserJID
parent
a954ab91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
spec/smacks.js
spec/smacks.js
+1
-0
src/headless/converse-core.js
src/headless/converse-core.js
+10
-7
No files found.
spec/smacks.js
View file @
a7184fab
...
@@ -122,6 +122,7 @@
...
@@ -122,6 +122,7 @@
expect
(
Strophe
.
serialize
(
iq
)).
toBe
(
expect
(
Strophe
.
serialize
(
iq
)).
toBe
(
`<iq id="
${
iq
.
getAttribute
(
'
id
'
)}
" type="get" xmlns="jabber:client"><query xmlns="jabber:iq:roster"/></iq>`
);
`<iq id="
${
iq
.
getAttribute
(
'
id
'
)}
" type="get" xmlns="jabber:client"><query xmlns="jabber:iq:roster"/></iq>`
);
await
_converse
.
api
.
waitUntil
(
'
statusInitialized
'
);
done
();
done
();
}));
}));
});
});
...
...
src/headless/converse-core.js
View file @
a7184fab
...
@@ -512,12 +512,12 @@ async function initUserSession (jid) {
...
@@ -512,12 +512,12 @@ async function initUserSession (jid) {
}
}
}
}
function
setUserJID
(
jid
)
{
async
function
setUserJID
(
jid
)
{
if
(
!
Strophe
.
getResourceFromJid
(
jid
))
{
if
(
!
Strophe
.
getResourceFromJid
(
jid
))
{
jid
=
jid
.
toLowerCase
()
+
_converse
.
generateResource
();
jid
=
jid
.
toLowerCase
()
+
_converse
.
generateResource
();
}
}
jid
=
jid
.
toLowerCase
();
jid
=
jid
.
toLowerCase
();
initUserSession
(
jid
);
await
initUserSession
(
jid
);
_converse
.
jid
=
jid
;
_converse
.
jid
=
jid
;
_converse
.
bare_jid
=
Strophe
.
getBareJidFromJid
(
jid
);
_converse
.
bare_jid
=
Strophe
.
getBareJidFromJid
(
jid
);
_converse
.
resource
=
Strophe
.
getResourceFromJid
(
jid
);
_converse
.
resource
=
Strophe
.
getResourceFromJid
(
jid
);
...
@@ -541,7 +541,7 @@ async function onConnected (reconnecting) {
...
@@ -541,7 +541,7 @@ async function onConnected (reconnecting) {
* by logging in or by attaching to an existing BOSH session.
* by logging in or by attaching to an existing BOSH session.
*/
*/
_converse
.
connection
.
flush
();
// Solves problem of returned PubSub BOSH response not received by browser
_converse
.
connection
.
flush
();
// Solves problem of returned PubSub BOSH response not received by browser
setUserJID
(
_converse
.
connection
.
jid
);
await
setUserJID
(
_converse
.
connection
.
jid
);
/**
/**
* Synchronous event triggered after we've sent an IQ to bind the
* Synchronous event triggered after we've sent an IQ to bind the
* user's JID resource for this session.
* user's JID resource for this session.
...
@@ -1230,7 +1230,7 @@ _converse.initialize = async function (settings, callback) {
...
@@ -1230,7 +1230,7 @@ _converse.initialize = async function (settings, callback) {
}
else
if
(
!
isTestEnv
()
&&
window
.
PasswordCredential
)
{
}
else
if
(
!
isTestEnv
()
&&
window
.
PasswordCredential
)
{
const
creds
=
await
navigator
.
credentials
.
get
({
'
password
'
:
true
});
const
creds
=
await
navigator
.
credentials
.
get
({
'
password
'
:
true
});
if
(
creds
&&
creds
.
type
==
'
password
'
&&
u
.
isValidJID
(
creds
.
id
))
{
if
(
creds
&&
creds
.
type
==
'
password
'
&&
u
.
isValidJID
(
creds
.
id
))
{
setUserJID
(
creds
.
id
);
await
setUserJID
(
creds
.
id
);
this
.
autoLogin
({
'
jid
'
:
creds
.
id
,
'
password
'
:
creds
.
password
});
this
.
autoLogin
({
'
jid
'
:
creds
.
id
,
'
password
'
:
creds
.
password
});
}
}
}
}
...
@@ -1454,12 +1454,15 @@ _converse.api = {
...
@@ -1454,12 +1454,15 @@ _converse.api = {
}
}
let
credentials
;
let
credentials
;
if
(
jid
&&
password
)
{
if
(
jid
&&
password
)
{
credentials
=
{
jid
:
jid
,
password
:
password
};
credentials
=
{
jid
,
password
};
}
else
if
(
u
.
isValidJID
(
_converse
.
jid
)
&&
_converse
.
password
)
{
}
else
if
(
u
.
isValidJID
(
_converse
.
jid
)
&&
_converse
.
password
)
{
credentials
=
{
jid
:
_converse
.
jid
,
password
:
_converse
.
password
};
credentials
=
{
jid
:
_converse
.
jid
,
password
:
_converse
.
password
};
}
}
if
(
credentials
&&
credentials
.
jid
)
{
if
(
credentials
&&
credentials
.
jid
)
{
setUserJID
(
credentials
.
jid
);
await
setUserJID
(
jid
||
_converse
.
jid
);
}
}
_converse
.
attemptNonPreboundSession
(
credentials
,
reconnecting
);
_converse
.
attemptNonPreboundSession
(
credentials
,
reconnecting
);
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment