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
e6f34069
Commit
e6f34069
authored
Mar 20, 2017
by
Soumit Bose
Committed by
JC Brand
Mar 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented auto fetching of registration form for default XMPP domain (#812)
parent
6e94e11d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
11 deletions
+63
-11
docs/CHANGES.md
docs/CHANGES.md
+2
-0
docs/source/configuration.rst
docs/source/configuration.rst
+8
-0
src/converse-core.js
src/converse-core.js
+1
-0
src/converse-register.js
src/converse-register.js
+40
-8
src/templates/register_panel.html
src/templates/register_panel.html
+9
-2
src/templates/registration_request.html
src/templates/registration_request.html
+3
-1
No files found.
docs/CHANGES.md
View file @
e6f34069
...
...
@@ -6,6 +6,8 @@
-
#628 Fixes the bug in displaying chat status during private chat. [saganshul]
-
#628 Changes the message displayed while typing from a different resource of the same user. [smitbose]
-
#675 Time format made configurable. [smitbose]
-
#704 Automatic fetching of registration form when
[
registration_domain
](
https://conversejs.org/
docs/html/configurations.html#registration-domain) is set. [smitbose]
-
#806 The
`_converse.listen`
API event listeners aren't triggered. [jcbrand]
-
#807 Error: Plugin "converse-dragresize" tried to override HeadlinesBoxView but it's not found. [jcbrand]
-
#820 Inconsistency in displaying room features. [jcbrand]
...
...
docs/source/configuration.rst
View file @
e6f34069
...
...
@@ -483,6 +483,14 @@ JIDs with other domains are still allowed but need to be provided in full.
To specify only one domain and disallow other domains, see the `locked_domain`_
option.
registration_domain
-------------------
* Default: ``''``
Specify a domain name for which the registration form will be fetched automatically,
without the user having to enter any XMPP server domain name.
default_state
-------------
...
...
src/converse-core.js
View file @
e6f34069
...
...
@@ -256,6 +256,7 @@
password
:
undefined
,
prebind_url
:
null
,
priority
:
0
,
registration_domain
:
''
,
rid
:
undefined
,
roster_groups
:
true
,
show_only_online_users
:
false
,
...
...
src/converse-register.js
View file @
e6f34069
...
...
@@ -72,6 +72,11 @@
'
model
'
:
this
});
this
.
registerpanel
.
render
().
$el
.
addClass
(
'
hidden
'
);
if
(
_converse
.
registration_domain
)
{
this
.
registerpanel
.
renderRegistrationRequest
(
''
);
this
.
registerpanel
.
fetchRegistrationForm
(
_converse
.
registration_domain
);
}
}
return
this
;
}
...
...
@@ -116,6 +121,7 @@
render
:
function
()
{
this
.
$parent
.
append
(
this
.
$el
.
html
(
tpl_register_panel
({
'
default_domain
'
:
_converse
.
registration_domain
,
'
label_domain
'
:
__
(
"
Your XMPP provider's domain name:
"
),
'
label_register
'
:
__
(
'
Fetch registration form
'
),
'
help_providers
'
:
__
(
'
Tip: A list of public XMPP providers is available
'
),
...
...
@@ -227,18 +233,36 @@
$domain_input
.
addClass
(
'
error
'
);
return
;
}
$form
.
find
(
'
input[type=submit]
'
).
hide
()
.
after
(
tpl_registration_request
({
cancel
:
__
(
'
Cancel
'
),
info_message
:
__
(
'
Requesting a registration form from the XMPP server
'
)
}));
$form
.
find
(
'
button.button-cancel
'
).
on
(
'
click
'
,
this
.
cancelRegistration
.
bind
(
this
));
$form
.
find
(
'
input[type=submit]
'
).
hide
();
this
.
renderRegistrationRequest
(
__
(
'
Cancel
'
));
this
.
fetchRegistrationForm
(
domain
);
},
fetchRegistrationForm
:
function
(
domain_name
)
{
/* This is called with a domain name based on which, it fetches a
* registration form from the requested domain.
*
* Parameters:
* (Domain name) domain_name - XMPP server domain
*/
this
.
reset
({
domain
:
Strophe
.
getDomainFromJid
(
domain
),
domain
:
Strophe
.
getDomainFromJid
(
domain
_name
),
_registering
:
true
});
_converse
.
connection
.
connect
(
this
.
domain
,
""
,
this
.
onRegistering
.
bind
(
this
));
return
false
;
return
false
;
},
renderRegistrationRequest
:
function
(
cancel_label
)
{
var
form_help
=
document
.
querySelector
(
'
.form-help
'
);
$
(
form_help
).
after
(
tpl_registration_request
({
cancel
:
cancel_label
,
info_message
:
_converse
.
__
(
'
Requesting a registration form from the XMPP server
'
)
}));
if
(
!
_converse
.
registration_domain
)
{
var
cancel_button
=
document
.
querySelector
(
'
button.button-cancel
'
);
cancel_button
.
addEventListener
(
'
click
'
,
this
.
cancelRegistration
.
bind
(
this
));
}
},
giveFeedback
:
function
(
message
,
klass
)
{
...
...
@@ -349,6 +373,9 @@
$form
.
append
(
'
<input type="button" class="submit" value="
'
+
__
(
'
Return
'
)
+
'
"/>
'
);
$form
.
find
(
'
input[type=button]
'
).
on
(
'
click
'
,
this
.
cancelRegistration
.
bind
(
this
));
}
if
(
_converse
.
registration_domain
)
{
$form
.
find
(
'
input[type=button]
'
).
hide
();
}
},
reportErrors
:
function
(
stanza
)
{
...
...
@@ -390,6 +417,11 @@
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
_converse
.
connection
.
reset
();
this
.
render
();
if
(
_converse
.
registration_domain
)
{
this
.
renderRegistrationRequest
(
__
(
'
Retry
'
));
document
.
querySelector
(
'
button.button-cancel
'
).
onclick
=
_
.
bind
(
this
.
fetchRegistrationForm
,
this
,
_converse
.
registration_domain
);
}
},
submitRegistrationForm
:
function
(
ev
)
{
...
...
src/templates/register_panel.html
View file @
e6f34069
<form
id=
"converse-register"
class=
"pure-form converse-form"
>
<span
class=
"reg-feedback"
></span>
<label>
{{{label_domain}}}
</label>
<input
type=
"text"
name=
"domain"
placeholder=
"{{{domain_placeholder}}}"
>
{[ if (default_domain) { ]}
<label>
{{{default_domain}}}
</label>
{[ } ]}
{[ if (!default_domain) { ]}
<input
type=
"text"
name=
"domain"
placeholder=
"{{{domain_placeholder}}}"
>
{[ } ]}
<p
class=
"form-help"
>
{{{help_providers}}}
<a
href=
"{{{href_providers}}}"
class=
"url"
target=
"_blank"
rel=
"noopener"
>
{{{help_providers_link}}}
</a>
.
</p>
<input
class=
"pure-button button-primary"
type=
"submit"
value=
"{{{label_register}}}"
>
{[ if (!default_domain) { ]}
<input
class=
"pure-button button-primary"
type=
"submit"
value=
"{{{label_register}}}"
>
{[ } ]}
</form>
src/templates/registration_request.html
View file @
e6f34069
<span
class=
"spinner login-submit"
/>
<p
class=
"info"
>
{{{info_message}}}
</p>
<button
class=
"pure-button button-cancel hor_centered"
>
{{{cancel}}}
</button>
{[ if (cancel) { ]}
<button
class=
"pure-button button-cancel hor_centered"
>
{{{cancel}}}
</button>
{[ } ]}
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