This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/factors/otp/models.py

32 lines
787 B
Python
Raw Normal View History

"""OTP Factor"""
from django.db import models
from django.utils.translation import gettext as _
from passbook.core.models import Factor, UserSettings
class OTPFactor(Factor):
"""OTP Factor"""
2019-12-31 11:51:16 +00:00
enforced = models.BooleanField(
default=False,
help_text=("Enforce enabled OTP for Users " "this factor applies to."),
)
2019-12-31 11:51:16 +00:00
type = "passbook.factors.otp.factors.OTPFactor"
form = "passbook.factors.otp.forms.OTPFactorForm"
def user_settings(self) -> UserSettings:
2019-12-31 11:51:16 +00:00
return UserSettings(
_("OTP"), "pficon-locked", "passbook_factors_otp:otp-user-settings"
)
def __str__(self):
2019-10-07 14:33:48 +00:00
return f"OTP Factor {self.slug}"
class Meta:
2019-12-31 11:51:16 +00:00
verbose_name = _("OTP Factor")
verbose_name_plural = _("OTP Factors")