Add a username split to XMPP to split the username and domain of the JID

RESOLVED FIXED

Status

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: mozbugs, Assigned: clokep)

Tracking

Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Reporter

Description

4 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36

Steps to reproduce:

Create an XMPP account and enter any username without the "@" character. Complete the account creation process.


Actual results:

Instantbird will give an error for that account saying: "Invalid username (your username should contain an '@' character)."


Expected results:

This issue has been reported by many Tor Messenger users. Perhaps we can indicate on the username page itself that a username (JID) is in the form of username@server, since users take username to be just the username minus domain.tld. Right now, the error is shown after the account creation process is completed.

I will submit a patch for this once we decide if we can show the message on the username page itself and in what way (whether through a label, error message, notification etc.) One easy way is changing the label from:

> Please enter the username for your XMPP account.

to:

> Please enter the username (user@domain) for your XMPP account.

or something similar.

Comment 1

4 years ago
Maybe you could use this to provide a hint? https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Attribute/placeholder

I agree it would be nice if the input was checked for validity immediately.
When we use the libpurple prpl for XMPP, the username is split between the username, the domain and the resource (http://i.imgur.com/0kYFwmW.png).

Was there a conscious decision to not do this for JS-XMPP, or was it just never implemented?
(In reply to Sukhbir Singh from comment #0)

> One easy way is changing the label from:
> 
> > Please enter the username for your XMPP account.
> 
> to:
> 
> > Please enter the username (user@domain) for your XMPP account.
> 
> or something similar.

This is supported, by setting the usernameEmptyText property on the protocol plugin:
http://mxr.mozilla.org/comm-central/source/chat/components/public/prplIProtocol.idl?rev=f81a23bfefcd#32

For example: http://mxr.mozilla.org/comm-central/source/chat/protocols/gtalk/gtalk.js?rev=f81a23bfefcd#92
Reporter

Comment 4

4 years ago
So summarizing the feedback on this:

- Should we redesign the JS-XMPP UI to match that of libpurple?
- Else, we can just use usernameEmptyText and set it to "username@domain.tld" or "username@domain.com" so that users know that they have to put in the JID and not just the handle.
  - If yes, should we validate immediately and not wait till the account completion process has completed? Or is setting the usernameEmptyText hint enough?

Comment 5

4 years ago
The libpurple UI had its own variant of this bug, bug 953873.
(In reply to Sukhbir Singh from comment #4)
> So summarizing the feedback on this:
> 
> - Should we redesign the JS-XMPP UI to match that of libpurple?

That doesn't require touching the UI code either, user name splits are already supported, you just need to declare them. See http://mxr.mozilla.org/comm-central/source/chat/protocols/irc/irc.js?rev=f28ff368b740#1915 for an example.

>   - If yes, should we validate immediately and not wait till the account
> completion process has completed? Or is setting the usernameEmptyText hint
> enough?

We already do some form of validation to avoid creating duplicate accounts. Checking that the username actually has a reasonable syntax would be a good addition.
Assignee

Comment 7

4 years ago
(In reply to Florian Quèze [:florian] [:flo] (Away until March 11) from comment #2)
> When we use the libpurple prpl for XMPP, the username is split between the
> username, the domain and the resource (http://i.imgur.com/0kYFwmW.png).
> 
> Was there a conscious decision to not do this for JS-XMPP, or was it just
> never implemented?

Just never implemented.


(In reply to Florian Quèze [:florian] [:flo] (Away until March 11) from comment #6)
> >   - If yes, should we validate immediately and not wait till the account
> > completion process has completed? Or is setting the usernameEmptyText hint
> > enough?
> 
> We already do some form of validation to avoid creating duplicate accounts.
> Checking that the username actually has a reasonable syntax would be a good
> addition.

I don't think that ever landed: bug 954943.

It'd be nice if a prpl could validate account information before being created, yes. But then we're conflating two issues. I'd suggest splitting that into a separate bug if it is desired.

Comment 8

4 years ago
(In reply to Patrick Cloke [:clokep] from comment #7)
> (In reply to Florian Quèze [:florian] [:flo] (Away until March 11) from
> comment #2)
> > When we use the libpurple prpl for XMPP, the username is split between the
> > username, the domain and the resource (http://i.imgur.com/0kYFwmW.png).
> > 
> > Was there a conscious decision to not do this for JS-XMPP, or was it just
> > never implemented?
> 
> Just never implemented.

As the bug I linked to earlier suggests, it's likely still necessary to provide a good hint or tooltip.
Reporter

Comment 9

4 years ago
So for now then, should I then focus on something that serves as a hint/tooltip using usernameEmptyText? The validation will then be another patch.
So, let's summarize:

- splitting the username is something that should be implemented. It's easy to do.

- validating the username syntax would be nice, but should be a separate bug.
Assignee

Comment 11

4 years ago
This implement the username split. Note that we don't include the resource (like libpurple does) since it is a protocol option in JS-XMPP. This was a choice we made on purpose, I believe.
Assignee: nobody → patrick+mozilla-bugzilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8572966 - Flags: review?(florian)
Attachment #8572966 - Flags: review?(florian) → review+
Assignee

Comment 12

4 years ago
Thanks! I'll check this in soon.
Component: Account wizard → XMPP
Product: Instantbird → Chat Core
Summary: Specify the format requirements for an XMPP username on the username page itself → Add a username split to XMPP to split the username and domain of the JID
Assignee

Comment 13

4 years ago
https://hg.mozilla.org/comm-central/rev/8d304929817c

If we want some sort of validation in the form, we need to file a new bug.

Should this be a 1.7 milestone at this point? (Or should we switch to Mozilla milestones?)
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

Comment 14

4 years ago
(In reply to Patrick Cloke [:clokep] from comment #13)
> https://hg.mozilla.org/comm-central/rev/8d304929817c
> 
> If we want some sort of validation in the form, we need to file a new bug.

This now also means bug 953873 needs fixing.

Updated

4 years ago
Depends on: 953873
You need to log in before you can comment on or make changes to this bug.