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
e31fa1f7
Commit
e31fa1f7
authored
Dec 29, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move converse-register plugin to folder
parent
828eac1e
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
653 additions
and
645 deletions
+653
-645
src/converse.js
src/converse.js
+1
-1
src/plugins/register.js
src/plugins/register.js
+0
-644
src/plugins/register/controlbox-mixin.js
src/plugins/register/controlbox-mixin.js
+34
-0
src/plugins/register/index.js
src/plugins/register/index.js
+82
-0
src/plugins/register/panel.js
src/plugins/register/panel.js
+536
-0
src/plugins/register/templates/register_panel.html
src/plugins/register/templates/register_panel.html
+0
-0
src/plugins/register/templates/registration_form.js
src/plugins/register/templates/registration_form.js
+0
-0
src/plugins/register/templates/registration_request.html
src/plugins/register/templates/registration_request.html
+0
-0
No files found.
src/converse.js
View file @
e31fa1f7
...
...
@@ -27,7 +27,7 @@ import "./plugins/notifications.js";
import
"
./plugins/omemo.js
"
;
import
"
./plugins/profile.js
"
;
import
"
./plugins/push.js
"
;
// XEP-0357 Push Notifications
import
"
./plugins/register
.js
"
;
// XEP-0077 In-band registration
import
"
./plugins/register
/index.js
"
;
// XEP-0077 In-band registration
import
"
./plugins/roomslist/index.js
"
;
// Show currently open chat rooms
import
"
./plugins/rosterview/index.js
"
;
import
"
./plugins/singleton.js
"
;
...
...
src/plugins/register.js
deleted
100644 → 0
View file @
828eac1e
This diff is collapsed.
Click to expand it.
src/plugins/register/controlbox-mixin.js
0 → 100644
View file @
e31fa1f7
import
{
_converse
,
api
}
from
'
@converse/headless/core
'
;
const
ControlBoxRegistrationMixin
=
{
showLoginOrRegisterForm
()
{
if
(
!
this
.
registerpanel
)
{
return
;
}
if
(
this
.
model
.
get
(
'
active-form
'
)
==
'
register
'
)
{
this
.
loginpanel
.
el
.
classList
.
add
(
'
hidden
'
);
this
.
registerpanel
.
el
.
classList
.
remove
(
'
hidden
'
);
}
else
{
this
.
loginpanel
.
el
.
classList
.
remove
(
'
hidden
'
);
this
.
registerpanel
.
el
.
classList
.
add
(
'
hidden
'
);
}
},
renderRegistrationPanel
()
{
if
(
api
.
settings
.
get
(
'
allow_registration
'
))
{
this
.
registerpanel
=
new
_converse
.
RegisterPanel
({
'
model
'
:
this
.
model
});
this
.
registerpanel
.
render
();
this
.
registerpanel
.
el
.
classList
.
add
(
'
hidden
'
);
const
login_panel
=
this
.
el
.
querySelector
(
'
#converse-login-panel
'
);
if
(
login_panel
)
{
login_panel
.
insertAdjacentElement
(
'
afterend
'
,
this
.
registerpanel
.
el
);
}
this
.
showLoginOrRegisterForm
();
}
return
this
;
}
};
export
default
ControlBoxRegistrationMixin
;
src/plugins/register/index.js
0 → 100644
View file @
e31fa1f7
/**
* @module converse-register
* @description
* This is a Converse.js plugin which add support for in-band registration
* as specified in XEP-0077.
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
import
'
../controlbox/index.js
'
;
import
ControlBoxRegistrationMixin
from
'
./controlbox-mixin.js
'
;
import
RegisterPanel
from
'
./panel.js
'
;
import
log
from
'
@converse/headless/log
'
;
import
{
__
}
from
'
i18n
'
;
import
{
_converse
,
api
,
converse
}
from
'
@converse/headless/core
'
;
// Strophe methods for building stanzas
const
{
Strophe
}
=
converse
.
env
;
// Add Strophe Namespaces
Strophe
.
addNamespace
(
'
REGISTER
'
,
'
jabber:iq:register
'
);
// Add Strophe Statuses
const
i
=
Object
.
keys
(
Strophe
.
Status
).
reduce
((
max
,
k
)
=>
Math
.
max
(
max
,
Strophe
.
Status
[
k
]),
0
);
Strophe
.
Status
.
REGIFAIL
=
i
+
1
;
Strophe
.
Status
.
REGISTERED
=
i
+
2
;
Strophe
.
Status
.
CONFLICT
=
i
+
3
;
Strophe
.
Status
.
NOTACCEPTABLE
=
i
+
5
;
converse
.
plugins
.
add
(
'
converse-register
'
,
{
enabled
()
{
return
true
;
},
overrides
:
{
// Overrides mentioned here will be picked up by converse.js's
// plugin architecture they will replace existing methods on the
// relevant objects or classes.
ControlBoxView
:
{
renderLoginPanel
()
{
// Also render a registration panel, when rendering the login panel.
this
.
__super__
.
renderLoginPanel
.
apply
(
this
,
arguments
);
this
.
renderRegistrationPanel
();
return
this
;
}
}
},
initialize
()
{
_converse
.
CONNECTION_STATUS
[
Strophe
.
Status
.
REGIFAIL
]
=
'
REGIFAIL
'
;
_converse
.
CONNECTION_STATUS
[
Strophe
.
Status
.
REGISTERED
]
=
'
REGISTERED
'
;
_converse
.
CONNECTION_STATUS
[
Strophe
.
Status
.
CONFLICT
]
=
'
CONFLICT
'
;
_converse
.
CONNECTION_STATUS
[
Strophe
.
Status
.
NOTACCEPTABLE
]
=
'
NOTACCEPTABLE
'
;
api
.
settings
.
extend
({
'
allow_registration
'
:
true
,
'
domain_placeholder
'
:
__
(
'
e.g. conversejs.org
'
),
// Placeholder text shown in the domain input on the registration form
'
providers_link
'
:
'
https://compliance.conversations.im/
'
,
// Link to XMPP providers shown on registration page
'
registration_domain
'
:
''
});
Object
.
assign
(
_converse
.
ControlBoxView
.
prototype
,
ControlBoxRegistrationMixin
);
_converse
.
RegisterPanel
=
RegisterPanel
;
function
setActiveForm
(
value
)
{
api
.
waitUntil
(
'
controlBoxInitialized
'
)
.
then
(()
=>
{
const
controlbox
=
_converse
.
chatboxes
.
get
(
'
controlbox
'
);
controlbox
.
set
({
'
active-form
'
:
value
});
})
.
catch
(
e
=>
log
.
fatal
(
e
));
}
_converse
.
router
.
route
(
'
converse/login
'
,
()
=>
setActiveForm
(
'
login
'
));
_converse
.
router
.
route
(
'
converse/register
'
,
()
=>
setActiveForm
(
'
register
'
));
api
.
listen
.
on
(
'
controlBoxInitialized
'
,
view
=>
{
view
.
model
.
on
(
'
change:active-form
'
,
view
.
showLoginOrRegisterForm
,
view
);
});
}
});
src/plugins/register/panel.js
0 → 100644
View file @
e31fa1f7
This diff is collapsed.
Click to expand it.
src/templates/register_panel.html
→
src/
plugins/register/
templates/register_panel.html
View file @
e31fa1f7
File moved
src/templates/registration_form.js
→
src/
plugins/register/
templates/registration_form.js
View file @
e31fa1f7
File moved
src/templates/registration_request.html
→
src/
plugins/register/
templates/registration_request.html
View file @
e31fa1f7
File moved
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