mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
Add TOTP authenticator support for Bambu Cloud login (fixes #182)
TOTP (Two-Factor Authentication): - Detect TOTP vs email verification from Bambu API loginType response - Use dedicated TFA endpoint on bambulab.com (not api.bambulab.com) - Include browser-like headers to bypass Cloudflare protection - Extract token from JSON response or cookies - Frontend shows appropriate messages for each verification type - Added i18n translations for TOTP UI (en, de, ja) Closes #182
This commit is contained in:
@@ -10,10 +10,11 @@ class CloudLoginRequest(BaseModel):
|
||||
|
||||
|
||||
class CloudVerifyRequest(BaseModel):
|
||||
"""Request to verify login with 2FA code."""
|
||||
"""Request to verify login with 2FA code (email or TOTP)."""
|
||||
|
||||
email: str = Field(..., description="Bambu Lab account email")
|
||||
code: str = Field(..., description="6-digit verification code from email")
|
||||
code: str = Field(..., description="6-digit verification code")
|
||||
tfa_key: str | None = Field(None, description="TFA key for TOTP verification (from login response)")
|
||||
|
||||
|
||||
class CloudLoginResponse(BaseModel):
|
||||
@@ -22,6 +23,8 @@ class CloudLoginResponse(BaseModel):
|
||||
success: bool
|
||||
needs_verification: bool = False
|
||||
message: str
|
||||
verification_type: str | None = None # "email" or "totp"
|
||||
tfa_key: str | None = None # Key needed for TOTP verification
|
||||
|
||||
|
||||
class CloudAuthStatus(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user