kumidc/authentication/helpers/otp.py

8 lines
194 B
Python
Raw Normal View History

2022-08-04 11:15:10 +00:00
from ..models import TOTPSecret
def has_otp(user):
try:
return bool(len(TOTPSecret.objects.filter(user=user, active=True)))
except TOTPSecret.DoesNotExist:
return False