mirror of
https://github.com/chatmail/relay.git
synced 2026-05-20 04:48:06 +00:00
doveauth: allow more than one invite token
This commit is contained in:
@@ -28,13 +28,17 @@ def is_allowed_to_create(config: Config, user, cleartext_password) -> bool:
|
|||||||
f"blocked account creation because {NOCREATE_FILE!r} exists."
|
f"blocked account creation because {NOCREATE_FILE!r} exists."
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
if cleartext_password.startswith(config.invite_token):
|
password_length = len(cleartext_password)
|
||||||
password_length = len(cleartext_password) - len(config.invite_token)
|
if config.invite_token:
|
||||||
else:
|
for inv_token in config.invite_token.split():
|
||||||
logging.warning(
|
if cleartext_password.startswith(inv_token):
|
||||||
f"blocked account creation because password didn't contain invite token(s)."
|
password_length = len(cleartext_password) - len(inv_token)
|
||||||
)
|
break
|
||||||
return False
|
else:
|
||||||
|
logging.warning(
|
||||||
|
f"blocked account creation because password didn't contain invite token(s)."
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
if password_length < config.password_min_length:
|
if password_length < config.password_min_length:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ def test_dont_overwrite_password_on_wrong_login(dictproxy):
|
|||||||
(False, False, "asdf", "z9873240187420913798"),
|
(False, False, "asdf", "z9873240187420913798"),
|
||||||
(False, True, "", "dsaiujfw9fjiwf9w"),
|
(False, True, "", "dsaiujfw9fjiwf9w"),
|
||||||
(False, False, "asdf", "z987324018742asdf0913798"),
|
(False, False, "asdf", "z987324018742asdf0913798"),
|
||||||
|
(False, True, "as df", "asj0wiefkj0ofkeefok"),
|
||||||
|
(False, True, "as df", "dfj0wiefkj0ofkeefok"),
|
||||||
|
(False, False, "as df", "j0wiefkj0ofas dfkeefok"),
|
||||||
(True, False, "asdf", "asdfmosadkdkfwdofkw"),
|
(True, False, "asdf", "asdfmosadkdkfwdofkw"),
|
||||||
(True, False, "asdf", "z9873240187420913798"),
|
(True, False, "asdf", "z9873240187420913798"),
|
||||||
(True, False, "", "dsaiujfw9fjiwf9w"),
|
(True, False, "", "dsaiujfw9fjiwf9w"),
|
||||||
|
|||||||
Reference in New Issue
Block a user