expephalon-kumisms/core/helpers/otp.py
Klaus-Uwe Mitterer 85fe13edcf Implemented TOTP
Implemented currencies and taxes
2020-05-22 18:13:23 +02:00

18 lines
No EOL
496 B
Python

from core.modules.otp import providers
def get_user_otps(user):
active_providers = {}
for name, provider in providers.items():
if provider().active_for_user(user):
active_providers[name] = provider
return active_providers
def get_otp_by_name(name):
for pname, provider in providers.items():
if pname == name:
return provider
def get_otp_choices(user):
return [(name, provider) for name, provider in get_user_otps(user).items()]