element-hq / element-hq/synapse
Option to allow numeric user IDs to be used upon registration (if guest access is disabled)
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#11534](https://github.com/matrix-org/synapse/issues/11534).
---
**Description:**
In certain countries (e.g. China) numbers are frequently used as identifiers, for example in emails (all those `@qq.com`, `@126.com` and so on).
If your Matrix homeserver doesn't allow guest access, you might want to allow users to register with digit-only usernames.
Especially if you use external authentication methods, such as [matrix-synapse-rest-password-provider](https://github.com/ma1uta/matrix-synapse-rest-password-provider).
It's not always possible to just rename a bunch of non-valid usernames in your existing database.
A quick and dirty solution is to just comment out these lines:
https://github.com/matrix-org/synapse/blob/e713855dca17a7605bae99ea8d71bc7f8657e4b8/synapse/handlers/register.py#L185-L194
That's what I did and it solved the issue for me. Was able to register and join/talk in rooms fine. However, it's definitely not ideal.
Contributor guide
Research direction
Start with synapse/handlers/register.py around lines 185-194 and compare the numeric-ID validation with the stated guest-access-disabled case. Define and test the intended registration behavior, including compatibility with existing numeric usernames and the external-authentication scenario described; done means numeric-only registration works under the requested condition without breaking normal registration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- authentication, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100