fix: invoke-email

This commit is contained in:
Yeuoly 2024-12-02 21:59:52 +08:00
parent 77a62f33b3
commit 632b2bac2a
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61

View File

@ -10,6 +10,7 @@ from typing import Any, Optional
from pydantic import BaseModel
from sqlalchemy import func
from sqlalchemy.orm import Session
from werkzeug.exceptions import Unauthorized
from configs import dify_config
@ -828,10 +829,11 @@ class RegisterService:
@classmethod
def invite_new_member(
cls, tenant: Tenant, email: str, language: str, role: str = "normal", inviter: Account = None
cls, tenant: Tenant, email: str, language: str, role: str = "normal", inviter: Account | None = None
) -> str:
"""Invite new member"""
account = Account.query.filter_by(email=email).first()
with Session(db.engine) as session:
account = session.query(Account).filter_by(email=email).first()
if not account:
TenantService.check_member_permission(tenant, inviter, None, "add")