Enforce lowercase username registration policy

This commit is contained in:
Maxime Dor
2017-10-08 04:58:35 +02:00
parent 83cb8bfce2
commit 8efcda5967
2 changed files with 6 additions and 7 deletions

View File

@@ -34,18 +34,17 @@ Set `endpoint` to the appropriate value.
## Next steps ## Next steps
### Lowercase username enforcement ### Lowercase username enforcement
If you would like to avoid user creating accounts with upper case letter in their usernames, To avoid creating users accounts with uppercase characters in their usernames and running into known
use the `enforceLowercase` config item. issues regarding case sensitivity in synapse, attempting to login with such username will fail.
It is highly recommended to enable this option to avoid nasty case sensitivity bugs and invites It is highly recommended to keep this feature enable, but in case you would like to disable it:
management on a day-to-day basis.
``` ```
[...] [...]
config: config:
policy: policy:
registration: registration:
username: username:
enforceLowercase: True enforceLowercase: False
``` ```
### Profile auto-fill ### Profile auto-fill

View File

@@ -66,7 +66,7 @@ class RestAuthProvider(object):
logger.info("User %s does not exist yet, creating...", user_id) logger.info("User %s does not exist yet, creating...", user_id)
if localpart != localpart.lower() and self.regLower: if localpart != localpart.lower() and self.regLower:
logger.info('User %s was not allowed to be created, enforcing lowercase policy', localpart) logger.info('User %s was cannot be created due to username lowercase policy', localpart)
defer.returnValue(False) defer.returnValue(False)
user_id, access_token = (yield self.account_handler.register(localpart=localpart)) user_id, access_token = (yield self.account_handler.register(localpart=localpart))
@@ -118,7 +118,7 @@ class RestAuthProvider(object):
class _RestConfig(object): class _RestConfig(object):
endpoint = '' endpoint = ''
regLower = False regLower = True
setNameOnRegister = True setNameOnRegister = True
setNameOnLogin = False setNameOnLogin = False