Files
pferd/PFERD/auth/tfa.py
I-Al-Istannen 6e563134b2 Fix ruff errors
2025-10-19 15:48:16 +02:00

29 lines
839 B
Python

from ..logging import log
from ..utils import ainput
from .authenticator import Authenticator, AuthError
class TfaAuthenticator(Authenticator):
def __init__(self, name: str) -> None:
super().__init__(name)
async def username(self) -> str:
raise AuthError("TFA authenticator does not support usernames")
async def password(self) -> str:
async with log.exclusive_output():
code = await ainput("TFA code: ")
return code
async def credentials(self) -> tuple[str, str]:
raise AuthError("TFA authenticator does not support usernames")
def invalidate_username(self) -> None:
raise AuthError("TFA authenticator does not support usernames")
def invalidate_password(self) -> None:
pass
def invalidate_credentials(self) -> None:
pass