feat: add multi-provider auth via AuthIdentity and extend site config
- Extract AuthIdentity model for multi-provider authentication (email_password, OAuth, Passkey, Magic Link) - Remove password field from User model, credentials now stored in AuthIdentity - Refactor unified login/register to use AuthIdentity-based provider checking - Add site config fields: footer_code, tos_url, privacy_url, auth_methods - Add auth settings defaults in migration (email_password enabled by default) - Update admin user creation to create AuthIdentity records - Update all tests to use AuthIdentity model Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,24 @@ async def test_site_config_captcha_settings(async_client: AsyncClient):
|
||||
assert "forgetCaptcha" in config
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_site_config_auth_methods(async_client: AsyncClient):
|
||||
"""测试配置包含认证方式列表"""
|
||||
response = await async_client.get("/api/site/config")
|
||||
assert response.status_code == 200
|
||||
|
||||
data = response.json()
|
||||
config = data["data"]
|
||||
assert "authMethods" in config
|
||||
assert isinstance(config["authMethods"], list)
|
||||
assert len(config["authMethods"]) > 0
|
||||
|
||||
# 每个认证方式应包含 provider 和 isEnabled
|
||||
for method in config["authMethods"]:
|
||||
assert "provider" in method
|
||||
assert "isEnabled" in method
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_site_captcha_endpoint_exists(async_client: AsyncClient):
|
||||
"""测试验证码端点存在(即使未实现也应返回有效响应)"""
|
||||
|
||||
Reference in New Issue
Block a user