feat(auth): prendre en charge le PIN de compte Pronote
This commit is contained in:
@@ -119,6 +119,9 @@ def _collect_auth_secrets(client: PronoteClient) -> list[str]:
|
||||
# PIN QR
|
||||
if settings.qr_pin is not None:
|
||||
secrets.append(settings.qr_pin.get_secret_value())
|
||||
# PIN de second facteur du compte
|
||||
if settings.account_pin is not None:
|
||||
secrets.append(settings.account_pin.get_secret_value())
|
||||
# Contenu du fichier QR (jeton, login, url)
|
||||
if settings.qr_code_file is not None:
|
||||
try:
|
||||
@@ -337,7 +340,12 @@ class PronoteClient:
|
||||
creds = self._auth_state.load()
|
||||
if creds is not None:
|
||||
try:
|
||||
client = client_class.token_login(**creds)
|
||||
account_pin = (
|
||||
self._settings.account_pin.get_secret_value()
|
||||
if self._settings.account_pin is not None
|
||||
else None
|
||||
)
|
||||
client = client_class.token_login(**creds, account_pin=account_pin)
|
||||
if client.logged_in:
|
||||
self._client = client
|
||||
self._persist_credentials()
|
||||
@@ -421,10 +429,16 @@ class PronoteClient:
|
||||
app_uuid = f"pronote-sync-{uuid4().hex}"
|
||||
|
||||
try:
|
||||
account_pin = (
|
||||
self._settings.account_pin.get_secret_value()
|
||||
if self._settings.account_pin is not None
|
||||
else None
|
||||
)
|
||||
client = client_class.qrcode_login(
|
||||
qr_code=qr_data,
|
||||
pin=pin_value,
|
||||
uuid=app_uuid,
|
||||
account_pin=account_pin,
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.error(
|
||||
|
||||
Reference in New Issue
Block a user