2018-12-14 12:51:12 +00:00
|
|
|
"""passbook captcha factor forms"""
|
|
|
|
from captcha.fields import ReCaptchaField
|
|
|
|
from django import forms
|
2019-10-09 10:47:14 +00:00
|
|
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
2020-02-27 15:39:30 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2018-12-14 12:51:12 +00:00
|
|
|
|
2019-10-07 14:33:48 +00:00
|
|
|
from passbook.factors.captcha.models import CaptchaFactor
|
2020-05-07 19:30:52 +00:00
|
|
|
from passbook.flows.forms import GENERAL_FIELDS
|
2019-02-24 21:39:09 +00:00
|
|
|
|
2018-12-14 12:51:12 +00:00
|
|
|
|
|
|
|
class CaptchaForm(forms.Form):
|
|
|
|
"""passbook captcha factor form"""
|
|
|
|
|
|
|
|
captcha = ReCaptchaField()
|
2019-02-24 21:39:09 +00:00
|
|
|
|
2019-12-31 11:51:16 +00:00
|
|
|
|
2019-02-24 21:39:09 +00:00
|
|
|
class CaptchaFactorForm(forms.ModelForm):
|
|
|
|
"""Form to edit CaptchaFactor Instance"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = CaptchaFactor
|
2019-12-31 11:51:16 +00:00
|
|
|
fields = GENERAL_FIELDS + ["public_key", "private_key"]
|
2019-02-24 21:39:09 +00:00
|
|
|
widgets = {
|
2019-12-31 11:51:16 +00:00
|
|
|
"name": forms.TextInput(),
|
|
|
|
"order": forms.NumberInput(),
|
|
|
|
"policies": FilteredSelectMultiple(_("policies"), False),
|
|
|
|
"public_key": forms.TextInput(),
|
|
|
|
"private_key": forms.TextInput(),
|
2019-02-24 21:39:09 +00:00
|
|
|
}
|
2020-02-27 15:39:30 +00:00
|
|
|
help_texts = {
|
|
|
|
"policies": _(
|
|
|
|
"Policies which determine if this factor applies to the current user."
|
|
|
|
)
|
|
|
|
}
|