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.
2019-02-25 11:29:40 +00:00
|
|
|
"""OTP Factor"""
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
from django.utils.translation import gettext as _
|
|
|
|
|
|
|
|
from passbook.core.models import Factor
|
|
|
|
|
|
|
|
|
|
|
|
class OTPFactor(Factor):
|
|
|
|
"""OTP Factor"""
|
|
|
|
|
|
|
|
enforced = models.BooleanField(default=False, help_text=('Enforce enabled OTP for Users '
|
|
|
|
'this factor applies to.'))
|
|
|
|
|
|
|
|
type = 'passbook.otp.factors.OTPFactor'
|
|
|
|
form = 'passbook.otp.forms.OTPFactorForm'
|
|
|
|
|
2019-02-25 12:20:07 +00:00
|
|
|
def has_user_settings(self):
|
|
|
|
return _('OTP'), 'pficon-locked', 'passbook_otp:otp-user-settings'
|
|
|
|
|
2019-02-25 11:29:40 +00:00
|
|
|
def __str__(self):
|
|
|
|
return "OTP Factor %s" % self.slug
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
verbose_name = _('OTP Factor')
|
|
|
|
verbose_name_plural = _('OTP Factors')
|