18 lines
No EOL
496 B
Python
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()] |