mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-13 07:55:05 +02:00
Restructure crawling and auth related modules
This commit is contained in:
parent
bbf9f8f130
commit
2fdf24495b
13 changed files with 29 additions and 33 deletions
36
PFERD/auth/tfa.py
Normal file
36
PFERD/auth/tfa.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
from typing import Tuple
|
||||
|
||||
from ..config import Config
|
||||
from ..logging import log
|
||||
from ..utils import ainput
|
||||
from .authenticator import Authenticator, AuthException, AuthSection
|
||||
|
||||
|
||||
class TfaAuthenticator(Authenticator):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
section: AuthSection,
|
||||
config: Config,
|
||||
) -> None:
|
||||
super().__init__(name, section, config)
|
||||
|
||||
async def username(self) -> str:
|
||||
raise AuthException("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 AuthException("TFA authenticator does not support usernames")
|
||||
|
||||
def invalidate_username(self) -> None:
|
||||
raise AuthException("TFA authenticator does not support usernames")
|
||||
|
||||
def invalidate_password(self) -> None:
|
||||
pass
|
||||
|
||||
def invalidate_credentials(self) -> None:
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue