@ -43,6 +43,8 @@ NEXT_WHITELIST = (
" hc-add-pushover " ,
" hc-add-pushover " ,
)
)
NAMESPACE_HC = uuid . UUID ( " 2b25afdf-ce1a-4fa3-adf2-592e35f27fa9 " )
def _is_whitelisted ( path ) :
def _is_whitelisted ( path ) :
try :
try :
@ -54,7 +56,10 @@ def _is_whitelisted(path):
def _make_user ( email , with_project = True ) :
def _make_user ( email , with_project = True ) :
username = str ( uuid . uuid4 ( ) ) [ : 30 ]
# Generate username from email in a deterministic way.
# Since the database has an uniqueness constraint on username,
# this makes sure that emails also are unique.
username = str ( uuid . uuid3 ( NAMESPACE_HC , email ) )
user = User ( username = username , email = email )
user = User ( username = username , email = email )
user . set_unusable_password ( )
user . set_unusable_password ( )
user . save ( )
user . save ( )