Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Mainline username generation #121

Merged
merged 5 commits into from
Jan 27, 2022
Merged

Mainline username generation #121

merged 5 commits into from
Jan 27, 2022

Commits on Jan 26, 2022

  1. Add a config flag to inhibit M_USER_IN_USE during registration (#11…

    …743)
    
    This is mostly motivated by the tchap use case, where usernames are automatically generated from the user's email address (in a way that allows figuring out the email address from the username). Therefore, it's an issue if we respond to requests on /register and /register/available with M_USER_IN_USE, because it can potentially leak email addresses (which include the user's real name and place of work).
    
    This commit adds a flag to inhibit the M_USER_IN_USE errors that are raised both by /register/available, and when providing a username early into the registration process. This error will still be raised if the user completes the registration process but the username conflicts. This is particularly useful when using modules (matrix-org/synapse#11790 adds a module callback to set the username of users at registration) or SSO, since they can ensure the username is unique.
    
    More context is available in the PR that introduced this behaviour to synapse-dinsic: #48 - as well as the issue in the matrix-dinsic repo: matrix-org/matrix-dinsic#476
    babolivier committed Jan 26, 2022
    Configuration menu
    Copy the full SHA
    42905ed View commit details
    Browse the repository at this point in the history
  2. Add a module callback to set username at registration (#11790)

    This is in the context of mainlining the Tchap fork of Synapse. Currently in Tchap usernames are derived from the user's email address (extracted from the UIA results, more specifically the m.login.email.identity step).
    This change also exports the check_username method from the registration handler as part of the module API, so that a module can check if the username it's trying to generate is correct and doesn't conflict with an existing one, and fallback gracefully if not.
    
    Co-authored-by: David Robertson <davidr@element.io>
    babolivier and David Robertson committed Jan 26, 2022
    Configuration menu
    Copy the full SHA
    3d78b3a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e3de7cf View commit details
    Browse the repository at this point in the history
  4. Mainline some more

    babolivier committed Jan 26, 2022
    Configuration menu
    Copy the full SHA
    0a3d781 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6a195c7 View commit details
    Browse the repository at this point in the history