element-hq / element-hq/synapse

Add a way to register the lower-case version of a conflicting MXID

Open
#15,931 0 comments 0 reactions 0 assignees View on GitHub
A-Registration
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#15931](https://github.com/matrix-org/synapse/pull/15931).

---

*This isn't meant to merge to main-line and is just a one-off fix so I can register a specific user.*

---

Add a way to register the lower-case version of a conflicting MXID.

Basically, if you have `@Foo:matrix.org` already registered, this will allow you register `@foo:matrix.org`

```
poetry run register_new_matrix_user --inhibit_user_in_use_error 1 -c homeserver.yaml
```

Fix https://github.com/matrix-org/synapse/issues/11426

---

[`inhibit_user_in_use_error`](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#inhibit_user_in_use_error) is already a homeserver configuration option but only applies to the username availability endpoint. This change makes it possible to configure the option when using the admin API to register a user.

### Testing strategy

1. Add a conflicting user `psql --user postgres synapse`
```sql
INSERT INTO users
(name, password_hash, creation_ts, is_guest, admin, shadow_banned, approved)
VALUES
('@test-COLLISION-user:my.synapse.linux.server', 'fake-password-hash', 1689216488, 0, 0, False, True);
```
1. `poetry run register_new_matrix_user --inhibit_user_in_use_error 1 -c homeserver.yaml`
- Enter `test-collision-user` and whatever data for the rest
1. Notice the `Success!` message

### Pull Request Checklist

* [ ] Pull request is based on the develop branch
* [ ] Pull request includes a [changelog file](https://matrix-org.github.io/synapse/latest/development/contributing_guide.html#changelog).
* [ ] Pull request includes a [sign off](https://matrix-org.github.io/synapse/latest/development/contributing_guide.html#sign-off)
* [ ] [Code style](https://matrix-org.github.io/synapse/latest/code_style.html) is correct
(run the [linters](https://matrix-org.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.