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

add the register_mxid_from_3pid setting #3096

Merged
merged 16 commits into from
May 4, 2018
Merged

Conversation

ara4n
Copy link
Member

@ara4n ara4n commented Apr 12, 2018

Adds a setting to prohibit users from picking their own mxid, but instead derive it from the 3PID that they provide during signup.

I need to test this and then seek review from @dbkr probably - opening the PR in order to link to it from elsewhere.

@giomfo
Copy link
Member

giomfo commented Apr 13, 2018

@ara4n
1- Did you handle the case where the email owner deactivated his account previously and try to register again with the same email. Then the desired_username (address.replace('@', '-').lower()) is already used. We may add an index in this case...
2- The server is supposed to force the display name too (see details in the issue).
[email protected] => Jean Moulin [finance]

@ara4n ara4n changed the base branch from develop to dinsic May 3, 2018 01:52
* [x] strip invalid characters from generated mxid
* [x] append numbers to disambiguate clashing mxids
* [x] generate displayanames from 3pids using a dodgy heuristic
* [x] get rid of the create_profile_with_localpart and instead
      explicitly set displaynames so they propagate correctly
@ara4n
Copy link
Member Author

ara4n commented May 3, 2018

@giomfo oops; fixed now (hopefully). Needs review though.


# XXX: a nasty heuristic to turn an email address into
# a displayname, as part of register_mxid_from_3pid
parts = address.replace('.', ' ').split('@')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're doing this for msisdns too - is this going to fail for these (presumably there just won't be a parts[1])

m = re.match(r'^(.*)(\d+)$', desired_username)
if m:
desired_username = m.group(1) + str(
int(m.group(2)) + 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a '1' on the end could be a bit confusing for msisdns

@ara4n
Copy link
Member Author

ara4n commented May 3, 2018

@dbkr hopefully ^ fixes that.

@ara4n
Copy link
Member Author

ara4n commented May 3, 2018

tests are borked; investigating.

@ara4n
Copy link
Member Author

ara4n commented May 4, 2018

well, that was a mess. going to merge now, but some retrospective review from @dbkr would be appreciated, especially as it touches on the profile replication stuff.

@ara4n ara4n merged commit c3ec84d into dinsic May 4, 2018
@ara4n ara4n changed the title add the register_mxid_from_3pid setting (untested) add the register_mxid_from_3pid setting May 4, 2018
@hawkowl hawkowl deleted the matthew/derive-mxid-from-3pid branch September 20, 2018 14:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants