fix: user invitation workflow for self hosted version (#1441)

This commit is contained in:
pablohashescobar 2023-07-04 13:56:51 +05:30 committed by GitHub
parent e4ee6a5bfb
commit 1a72a0dff4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ from django.db.models import (
) )
from django.db.models.functions import ExtractWeek, Cast, ExtractDay from django.db.models.functions import ExtractWeek, Cast, ExtractDay
from django.db.models.fields import DateField from django.db.models.fields import DateField
from django.contrib.auth.hashers import make_password
# Third party modules # Third party modules
from rest_framework import status from rest_framework import status
@ -318,11 +319,12 @@ class InviteWorkspaceEndpoint(BaseAPIView):
_ = User.objects.bulk_create( _ = User.objects.bulk_create(
[ [
User( User(
email=email.get("email"), username=str(uuid4().hex),
password=str(uuid4().hex), email=invitation.email,
password=make_password(uuid4().hex),
is_password_autoset=True, is_password_autoset=True,
) )
for email in emails for invitation in workspace_invitations
], ],
batch_size=100, batch_size=100,
) )