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
46ca6c7d
Commit
46ca6c7d
authored
Oct 31, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the router global and clear login/register fragments
upon login or after registering.
parent
61ed55db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
16 deletions
+22
-16
src/converse-controlbox.js
src/converse-controlbox.js
+4
-0
src/converse-core.js
src/converse-core.js
+3
-0
src/converse-register.js
src/converse-register.js
+15
-16
No files found.
src/converse-controlbox.js
View file @
46ca6c7d
...
...
@@ -550,6 +550,10 @@
jid
=
Strophe
.
getBareJidFromJid
(
jid
).
toLowerCase
()
+
'
/
'
+
resource
;
}
}
if
(
_
.
includes
([
"
converse/login
"
,
"
converse/register
"
],
Backbone
.
history
.
getFragment
()))
{
_converse
.
router
.
navigate
(
''
,
{
'
replace
'
:
true
});
}
_converse
.
connection
.
reset
();
_converse
.
connection
.
connect
(
jid
,
password
,
_converse
.
onConnectStatusChanged
);
}
...
...
src/converse-core.js
View file @
46ca6c7d
...
...
@@ -230,6 +230,9 @@
}
};
_converse
.
router
=
new
Backbone
.
Router
();
_converse
.
initialize
=
function
(
settings
,
callback
)
{
"
use strict
"
;
settings
=
!
_
.
isUndefined
(
settings
)
?
settings
:
{};
...
...
src/converse-register.js
View file @
46ca6c7d
...
...
@@ -145,19 +145,15 @@
providers_link
:
'
https://xmpp.net/directory.php
'
,
// Link to XMPP providers shown on registration page
});
const
RegistrationRouter
=
Backbone
.
Router
.
extend
({
initialize
()
{
this
.
route
(
'
converse/login
'
,
_
.
partial
(
this
.
setActiveForm
,
'
login
'
));
this
.
route
(
'
converse/register
'
,
_
.
partial
(
this
.
setActiveForm
,
'
register
'
));
},
setActiveForm
(
value
)
{
function
setActiveForm
(
value
)
{
_converse
.
api
.
waitUntil
(
'
controlboxInitialized
'
).
then
(()
=>
{
const
controlbox
=
_converse
.
chatboxes
.
get
(
'
controlbox
'
)
controlbox
.
set
({
'
active-form
'
:
value
});
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
}
);
const
router
=
new
RegistrationRouter
(
);
_converse
.
router
.
route
(
'
converse/login
'
,
_
.
partial
(
setActiveForm
,
'
login
'
)
);
_converse
.
router
.
route
(
'
converse/register
'
,
_
.
partial
(
setActiveForm
,
'
register
'
)
);
_converse
.
RegisterPanel
=
Backbone
.
View
.
extend
({
...
...
@@ -419,11 +415,14 @@
);
this
.
abortRegistration
();
}
else
if
(
status_code
===
Strophe
.
Status
.
REGISTERED
)
{
router
.
navigate
();
// Strip the URL fragment
_converse
.
log
(
"
Registered successfully.
"
);
_converse
.
connection
.
reset
();
this
.
showSpinner
();
if
(
_
.
includes
([
"
converse/login
"
,
"
converse/register
"
],
Backbone
.
History
.
getFragment
()))
{
_converse
.
router
.
navigate
(
''
,
{
'
replace
'
:
true
});
}
if
(
this
.
fields
.
password
&&
this
.
fields
.
username
)
{
// automatically log the user in
_converse
.
connection
.
connect
(
...
...
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