mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 09:39:02 +08:00
fix: --name option for the create-tenant command does not take effect (#11993)
This commit is contained in:
parent
cdaef30cc9
commit
49bc602fb2
@ -561,8 +561,13 @@ def create_tenant(email: str, language: Optional[str] = None, name: Optional[str
|
|||||||
new_password = secrets.token_urlsafe(16)
|
new_password = secrets.token_urlsafe(16)
|
||||||
|
|
||||||
# register account
|
# register account
|
||||||
account = RegisterService.register(email=email, name=account_name, password=new_password, language=language)
|
account = RegisterService.register(
|
||||||
|
email=email,
|
||||||
|
name=account_name,
|
||||||
|
password=new_password,
|
||||||
|
language=language,
|
||||||
|
create_workspace_required=False,
|
||||||
|
)
|
||||||
TenantService.create_owner_tenant_if_not_exist(account, name)
|
TenantService.create_owner_tenant_if_not_exist(account, name)
|
||||||
|
|
||||||
click.echo(
|
click.echo(
|
||||||
|
@ -797,6 +797,7 @@ class RegisterService:
|
|||||||
language: Optional[str] = None,
|
language: Optional[str] = None,
|
||||||
status: Optional[AccountStatus] = None,
|
status: Optional[AccountStatus] = None,
|
||||||
is_setup: Optional[bool] = False,
|
is_setup: Optional[bool] = False,
|
||||||
|
create_workspace_required: Optional[bool] = True,
|
||||||
) -> Account:
|
) -> Account:
|
||||||
db.session.begin_nested()
|
db.session.begin_nested()
|
||||||
"""Register account"""
|
"""Register account"""
|
||||||
@ -814,7 +815,7 @@ class RegisterService:
|
|||||||
if open_id is not None and provider is not None:
|
if open_id is not None and provider is not None:
|
||||||
AccountService.link_account_integrate(provider, open_id, account)
|
AccountService.link_account_integrate(provider, open_id, account)
|
||||||
|
|
||||||
if FeatureService.get_system_features().is_allow_create_workspace:
|
if FeatureService.get_system_features().is_allow_create_workspace and create_workspace_required:
|
||||||
tenant = TenantService.create_tenant(f"{account.name}'s Workspace")
|
tenant = TenantService.create_tenant(f"{account.name}'s Workspace")
|
||||||
TenantService.create_tenant_member(tenant, account, role="owner")
|
TenantService.create_tenant_member(tenant, account, role="owner")
|
||||||
account.current_tenant = tenant
|
account.current_tenant = tenant
|
||||||
|
Loading…
x
Reference in New Issue
Block a user