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-26 20:55:37 +00:00
|
|
|
SelectField, Form as NoCsrfForm, SelectMultipleField
|
2020-05-27 19:16:14 +00:00
|
|
|
from wtforms.fields.html5 import EmailField
|
2020-05-09 18:00:07 +00:00
|
|
|
from wtforms.widgets.html5 import NumberInput, DateInput
|
|
|
|
from wtforms.validators import DataRequired, NumberRange, Optional, NoneOf, Length
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
|
|
class LoginForm(FlaskForm):
|
2020-05-27 19:16:14 +00:00
|
|
|
name = StringField(gettext('Username'), validators=[DataRequired()])
|
2020-05-09 18:00:07 +00:00
|
|
|
submit = SubmitField(gettext('Login'))
|
|
|
|
|
|
|
|
|
|
|
|
class PasswordForm(FlaskForm):
|
|
|
|
password = PasswordField(gettext('Password'))
|
|
|
|
submit = SubmitField(gettext('Authorize'))
|
|
|
|
|
|
|
|
|
|
|
|
class TotpForm(FlaskForm):
|
|
|
|
totp = TextField(gettext('2FA Token'))
|
|
|
|
submit = SubmitField(gettext('Authorize'))
|
|
|
|
|
|
|
|
|
|
|
|
class Fido2Form(FlaskForm):
|
|
|
|
fido2 = TextField(gettext('Fido2'), default="Javascript Required")
|
|
|
|
submit = SubmitField(gettext('Authorize'))
|
2020-05-26 20:55:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ConsentForm(FlaskForm):
|
|
|
|
# scopes = SelectMultipleField(gettext('scopes'))
|
|
|
|
# audiences = SelectMultipleField(gettext('audiences'))
|
|
|
|
remember = BooleanField(gettext('remember me'))
|
|
|
|
submit = SubmitField()
|
|
|
|
|
2020-05-27 19:16:14 +00:00
|
|
|
|
|
|
|
class RegistrationForm(FlaskForm):
|
|
|
|
username = StringField(gettext('Username'), validators=[DataRequired()])
|
|
|
|
password = PasswordField(gettext('Password'), validators=[DataRequired()])
|
|
|
|
alternative_email = EmailField(gettext('Alternative Email'))
|
|
|
|
submit = SubmitField()
|