Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible fix for issue #1185 #1249

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/converse-controlbox.js
Expand Up @@ -290,6 +290,8 @@
} else {
this.loginpanel.render();
}
/* ***Add this line to pre-populate the username field*** */
document.getElementById("converse-login-jid").value = _converse.jid;
this.loginpanel.initPopovers();
return this;
},
Expand Down
2 changes: 1 addition & 1 deletion src/converse-roster.js
Expand Up @@ -539,7 +539,7 @@
*/
const id = iq.getAttribute('id');
const from = iq.getAttribute('from');
if (from && from !== _converse.connection.jid) {
if (from && from !== _converse.bare_jid) {
// https://tools.ietf.org/html/rfc6121#page-15
//
// A receiving client MUST ignore the stanza unless it has no 'from'
Expand Down
22 changes: 14 additions & 8 deletions src/converse-rosterview.js
Expand Up @@ -146,7 +146,7 @@
return tpl_add_contact_modal(_.extend(this.model.toJSON(), {
'_converse': _converse,
'heading_new_contact': __('Add a Contact'),
'label_xmpp_address': __('XMPP Address'),
'label_xmpp_address': __('Mobile number or XMPP Address'),
'label_nickname': label_nickname,
'contact_placeholder': __('name@example.org'),
'label_add': __('Add'),
Expand Down Expand Up @@ -208,19 +208,25 @@
addContactFromForm (ev) {
ev.preventDefault();
const data = new FormData(ev.target),
jid = data.get('jid'),
name = data.get('name');
if (!jid || _.compact(jid.split('@')).length < 2) {
var jid = data.get('jid');
if (jid && _.compact(jid.split('@')).length === 2) {
ev.target.reset();
_converse.roster.addAndSubscribe(jid, name);
this.model.clear();
this.modal.hide();
} else if (jid && jid.match(/^[0-9]+$/) != null) {
jid = jid + '@' + _converse.default_domain;
ev.target.reset();
_converse.roster.addAndSubscribe(jid, name);
this.model.clear();
this.modal.hide();
} else {
// XXX: we have to do this manually, instead of via
// toHTML because Awesomplete messes things up and
// confuses Snabbdom
u.addClass('is-invalid', this.el.querySelector('input[name="jid"]'));
u.addClass('d-block', this.el.querySelector('.invalid-feedback'));
} else {
ev.target.reset();
_converse.roster.addAndSubscribe(jid, name);
this.model.clear();
this.modal.hide();
}
}
});
Expand Down