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

Registration: Allow registration without a username #400

Closed
3 tasks
matrixbot opened this issue Oct 30, 2024 · 3 comments
Closed
3 tasks

Registration: Allow registration without a username #400

matrixbot opened this issue Oct 30, 2024 · 3 comments

Comments

@matrixbot
Copy link
Collaborator

This issue was originally created by @anoadragon453 at matrix-org/dendrite#400.

Spec URL: https://matrix.org/docs/spec/client_server/r0.3.0.html#post-matrix-client-r0-register

If omitted, the homeserver MUST generate a Matrix ID local part.

Phase: 1

We currently do not generate a username if username is not set as part of a POST request to /register.

Sent Request

{
    "password": "asd",
    "auth": {
        "type": "m.login.dummy",
        "session": "Mxa1dMHgfP2VTIFNNgSkDL5n"
    }
}

Received Response

Synapse:

{
  "access_token": "...",
  "home_server": "amorgan.xyz",
  "user_id": "@15:amorgan.xyz",
  "device_id": "IGKRGSXVFW"
}

Dendrite:

{
  "errcode": "M_INVALID_USERNAME",
  "error": "User ID can only contain characters a-z, 0-9, or '_-./'"
}

I believe Synapse will just set the new username to the next available user ID. So for instance, if my homeserver has registered 3 users, the newly generated username would be @4:homeserver.xyz. We can either use this method or some other method that generates ID in an increasing manner.

Summary:

  • Don't error out if a username is not provided as part of registration
  • Generate and return a new username if one was not provided
  • Create test case(s) that checks for a successful registration without a username, and that the returned generated username is valid
@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @jsinghrai at matrix-org/dendrite#400 (comment).

Mind If I take this issue.

@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @anoadragon453 at matrix-org/dendrite#400 (comment).

@jsinghrai Go for it!

@matrixbot
Copy link
Collaborator Author

This comment was originally posted by @anoadragon453 at matrix-org/dendrite#400 (comment).

We currently validate usernames here:

https://github.com/matrix-org/dendrite/blob/dfcf31f293a319830e2b8a188413db776930a5e5/src/github.com/matrix-org/dendrite/clientapi/routing/register.go#L373-L378

If there is no username, then we should generate one instead and use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant