Auto-default homeserver suffix for username and room during interactive login#219
Auto-default homeserver suffix for username and room during interactive login#219Itz-Agasta wants to merge 5 commits into
Conversation
|
The changes look decent, I have not checked them yet, I am waiting answer to my comment. |
…e login The interactive login asks for the homeserver first. For username and default room, accept either a bare local part (e.g. "john", "someRoomId") — appending the homeserver automatically — or a full id pasted from a client (e.g. "@john:server", "!room:server"), which is used verbatim.
|
I finalized with this rule:
I originally wanted to accept only bare input--just but after thinking about it more (and looking at issue #220), I think the "accept either form" approach is better. The rule is consistent across usernames and room IDs, and it naturally supports delegated identifiers. If someone pastes room IDs are almost never typed manually--they're copied. Every Matrix client gives you the full |
|
Do you have an idea of the wanted flow @8go? |
|
Note that rooms can also be named rooms and start with Example: |
|
For me personally there is NO doubt. User should have choice of entering either version, short or long. It is up to the software to adapt. mc should accept pretty much everything (short, long) and then complete it if necessary. Give the user the maximum choice please. If you follow this then there are like 4 choices for rooms: |
|
guys have a look now Room (get_room_default):
Username (get_user_login):
|
Personal notes concerning named room:DuckDuckGo and Google search Element named room URI. is an example. |
|
Changes look decent, but I have not tested them yet. What do you (also @8go) think about using regex? This may help state that the expected format is not respected (if specify |
Mmmm yes && regex is already a dep so no new dependency. yk i'd like to keep the pattern loose, not a strict MXID grammar. A tight regex risks rejecting valid input , e.g. so Something like validate only the structure on the verbatim (contains ':') path:
.+ after the colon still allows ports/IPv6/aliases, but it catches the real typo cases (room:, :server, bare @) with a clear "format not respected" message. The authoritative check still happens server-side at login. |
|
Indeed a correct regex may not be trivial, let us forget about that. I'll give a try to your changes in less than 72 hours. |
|
My humble opinion: Handling shortcuts and sigils and the simple and obvious cases (as done) IS GOOD ENOUGH. I myself do not even know the full syntax of user and room names (I would have to look it up). I would NOT do a FULL and COMPLETE check. I would not to a FULL REGEX to try to capture ALL errors. The server already implements that. Let's not re-implement it. We try to be user friendly and we should handle cases to make it user friendly, but not more. |
|
@Itz-Agasta says:
I fully agree with that |
cargo run -- --login password --credentials credentials.json --store store/Output:cargo run -- --login password --credentials credentials.json --store store/Output:In my opinion we could assume cargo run -- --login password --credentials credentials.json --store store/Output:cargo run -- --login password --credentials credentials.json --store store/Output:cargo run -- --login password --credentials credentials.json --store store/Output:@Itz-Agasta the latter command should work, no? I have verified twice that the credentials are correct. If you're fine with making it work, then please add a correcting commit. Otherwise everything looks good to me, thank you. |
Interactive login rejected a username or room entered with a ':' domain but no leading sigil (e.g`overclock3000:matrix.org` or `sNARMdEsFZERaQAJzl:matrix.org`), causing a 403 login failure since Matrix requires the '@' / '!' sigil. The ':'-present branch now prepends '@' for usernames and '!' for rooms when no sigil is present, matching the sigil-less local-part branch.
Have a look it should work now... i have tested locally.. we are currently covering
Lemme know if im missing something |
|
Other changes look correct, but will be tested once you will address the comment I let. |
'abc:server' is ambiguous: it can be the room id '!abc:server' or the room alias '#abc:server', and nothing can tell them apart before login. Prompt again instead of guessing '!'. Full room ids and full room aliases are now stored verbatim. User ids are unaffected: '@' is the only sigil there, so 'john:server' remains an unambiguous completion. Also mention the room alias form in the prompt, as it is accepted too.
'some.homeserver.org:8448' parses as a URL with scheme 'some.homeserver.org' and no host, so host_str().unwrap() panicked while completing the user name and the room. Assume 'https://' unless the input already is a URL with a host, which also lets the user enter a bare 'some.homeserver.org'.
During
--login password(and other interactive login flows), the homeserver is entered first. If the user then types a bare username (@agasta) or default room (!roomid) without the:homeserversuffix, the prompt rejected it with "Invalid username/room format" and forced the user to retype the full id.Now, if the input is missing the
:homeserverpart, it's auto-appended using the homeserver already entered, same UX improvement.Closes #217
matrix2.mp4