fix
This commit is contained in:
parent
d3aa746e0b
commit
69214ee7ae
|
|
@ -23,23 +23,15 @@ def register_user(
|
||||||
username: str = typer.Argument(..., help="用户名"),
|
username: str = typer.Argument(..., help="用户名"),
|
||||||
email: str = typer.Argument(..., help="邮箱地址"),
|
email: str = typer.Argument(..., help="邮箱地址"),
|
||||||
display_name: Optional[str] = typer.Option(None, "--display-name", "-d", help="显示名称"),
|
display_name: Optional[str] = typer.Option(None, "--display-name", "-d", help="显示名称"),
|
||||||
password: Optional[str] = typer.Option(None, "--password", "-p", help="密码(不提供则交互式输入)"),
|
password: Optional[str] = typer.Option(None, "--password", "-p", help="密码(不提供则交互式输入)")
|
||||||
verbose: bool = typer.Option(False, "--verbose", "-v", help="详细输出"),
|
|
||||||
json_output: bool = typer.Option(False, "--json", help="JSON格式输出")
|
|
||||||
):
|
):
|
||||||
"""注册新用户"""
|
"""注册新用户"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = create_response_handler(uuid4())
|
response = create_response_handler(uuid4())
|
||||||
console.print(f"🆕 [bold blue]用户注册[/bold blue]")
|
|
||||||
console.print(f"用户名: {username}")
|
|
||||||
console.print(f"邮箱: {email}")
|
|
||||||
if display_name:
|
|
||||||
console.print(f"显示名称: {display_name}")
|
|
||||||
|
|
||||||
# 获取密码
|
# 获取密码
|
||||||
if not password:
|
if not password:
|
||||||
response.error("[red]❌ 密码不能为空[/red]")
|
response.error("❌ 密码不能为空")
|
||||||
raise typer.Exit(1)
|
raise typer.Exit(1)
|
||||||
|
|
||||||
# 执行注册
|
# 执行注册
|
||||||
|
|
@ -51,7 +43,7 @@ def register_user(
|
||||||
})
|
})
|
||||||
response.success(result)
|
response.success(result)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
console.print(f"[red]❌ 注册失败: {str(e)}[/red]")
|
response.error(f"❌ 注册失败: {str(e)}")
|
||||||
raise typer.Exit(1)
|
raise typer.Exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ class PythonCliAuth {
|
||||||
json_output: true
|
json_output: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log({ response })
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
throw new Error(response.error || response.message || 'Registration failed');
|
throw new Error(response.error || response.message || 'Registration failed');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue