kumidc/authentication/helpers/otp.py
2022-08-04 13:15:10 +02:00

8 lines
No EOL
194 B
Python

from ..models import TOTPSecret
def has_otp(user):
try:
return bool(len(TOTPSecret.objects.filter(user=user, active=True)))
except TOTPSecret.DoesNotExist:
return False