mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
Merge branch 'feat/new-login' into deploy/dev
* feat/new-login: feat: update invite member
This commit is contained in:
commit
d00b570ddc
|
@ -785,12 +785,17 @@ class RegisterService:
|
||||||
provider: Optional[str] = None,
|
provider: Optional[str] = None,
|
||||||
language: Optional[str] = None,
|
language: Optional[str] = None,
|
||||||
status: Optional[AccountStatus] = None,
|
status: Optional[AccountStatus] = None,
|
||||||
|
is_setup: Optional[bool] = False,
|
||||||
) -> Account:
|
) -> Account:
|
||||||
db.session.begin_nested()
|
db.session.begin_nested()
|
||||||
"""Register account"""
|
"""Register account"""
|
||||||
try:
|
try:
|
||||||
account = AccountService.create_account(
|
account = AccountService.create_account(
|
||||||
email=email, name=name, interface_language=language or languages[0], password=password
|
email=email,
|
||||||
|
name=name,
|
||||||
|
interface_language=language or languages[0],
|
||||||
|
password=password,
|
||||||
|
is_setup=is_setup,
|
||||||
)
|
)
|
||||||
account.status = AccountStatus.ACTIVE.value if not status else status.value
|
account.status = AccountStatus.ACTIVE.value if not status else status.value
|
||||||
account.initialized_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
account.initialized_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||||
|
@ -825,7 +830,9 @@ class RegisterService:
|
||||||
TenantService.check_member_permission(tenant, inviter, None, "add")
|
TenantService.check_member_permission(tenant, inviter, None, "add")
|
||||||
name = email.split("@")[0]
|
name = email.split("@")[0]
|
||||||
|
|
||||||
account = cls.register(email=email, name=name, language=language, status=AccountStatus.PENDING)
|
account = cls.register(
|
||||||
|
email=email, name=name, language=language, status=AccountStatus.PENDING, is_setup=True
|
||||||
|
)
|
||||||
# Create new tenant member for invited tenant
|
# Create new tenant member for invited tenant
|
||||||
TenantService.create_tenant_member(tenant, account, role)
|
TenantService.create_tenant_member(tenant, account, role)
|
||||||
TenantService.switch_tenant(account, tenant.id)
|
TenantService.switch_tenant(account, tenant.id)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user