feat: support re-invite email. (#2107)

This commit is contained in:
Garfield Dai
2024-01-20 22:28:41 +08:00
committed by GitHub
parent 1f48e3d44a
commit 51f23c5dc2
2 changed files with 14 additions and 14 deletions

View File

@@ -464,16 +464,21 @@ class RegisterService:
account = AccountService.create_account(email, name)
account.status = AccountStatus.PENDING.value
db.session.commit()
TenantService.create_tenant_member(tenant, account, role)
else:
TenantService.check_member_permission(tenant, inviter, account, 'add')
ta = TenantAccountJoin.query.filter_by(
tenant_id=tenant.id,
account_id=account.id
).first()
if ta:
raise AccountAlreadyInTenantError("Account already in tenant.")
TenantService.create_tenant_member(tenant, account, role)
if not ta:
TenantService.create_tenant_member(tenant, account, role)
# Support resend invitation email when the account is pending status
if account.status != AccountStatus.PENDING.value:
raise AccountAlreadyInTenantError("Account already in tenant.")
token = cls.generate_invite_token(tenant, account)