2020-05-09 18:00:07 +00:00
|
|
|
from flask_babel import gettext
|
|
|
|
from flask_wtf import FlaskForm
|
|
|
|
from wtforms import StringField, SubmitField, TextField, \
|
|
|
|
TextAreaField, PasswordField, IntegerField, FloatField, \
|
|
|
|
DateTimeField, DateField, FormField, BooleanField, \
|
2020-05-10 12:34:28 +00:00
|
|
|
SelectField, Form as NoCsrfForm, HiddenField
|
2020-05-09 18:00:07 +00:00
|
|
|
from wtforms.widgets.html5 import NumberInput, DateInput
|
2020-05-10 12:34:28 +00:00
|
|
|
from wtforms.validators import DataRequired, NumberRange, \
|
|
|
|
Optional, NoneOf, Length
|
2020-05-09 18:00:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ClientCertForm(FlaskForm):
|
|
|
|
publickey = TextAreaField(gettext('Public Key'), validators=[
|
|
|
|
DataRequired()
|
|
|
|
])
|
|
|
|
valid_time = IntegerField(
|
|
|
|
gettext('valid time in days'),
|
|
|
|
default=365,
|
|
|
|
validators=[
|
|
|
|
DataRequired(),
|
|
|
|
NumberRange(min=1, max=365*2)
|
|
|
|
])
|
|
|
|
submit = SubmitField(gettext('Submit'))
|
2020-05-10 12:34:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TOTPForm(FlaskForm):
|
|
|
|
secret = HiddenField(gettext('totp-Secret'))
|
|
|
|
token = TextField(gettext('totp-verify token'))
|
|
|
|
name = TextField(gettext('name'))
|
|
|
|
submit = SubmitField(gettext('Activate'))
|
|
|
|
|
|
|
|
|
|
|
|
class TOTPDeleteForm(FlaskForm):
|
|
|
|
submit = SubmitField(gettext('Delete'))
|