lenticular_cloud2/lenticular_cloud/form/frontend.py

47 lines
1.8 KiB
Python
Raw Permalink Normal View History

2020-05-09 18:00:07 +00:00
from flask_babel import gettext
from flask_wtf import FlaskForm
2022-06-17 07:25:14 +00:00
from wtforms import StringField, SubmitField, \
2020-05-09 18:00:07 +00:00
TextAreaField, PasswordField, IntegerField, FloatField, \
DateTimeField, DateField, FormField, BooleanField, \
2020-05-10 12:34:28 +00:00
SelectField, Form as NoCsrfForm, HiddenField
2022-06-17 07:25:14 +00:00
from wtforms.widgets import NumberInput, DateInput
2020-05-10 12:34:28 +00:00
from wtforms.validators import DataRequired, NumberRange, \
2022-04-08 19:28:22 +00:00
Optional, NoneOf, Length, EqualTo, InputRequired
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
2022-07-15 08:53:06 +00:00
class AppTokenForm(FlaskForm):
name = StringField(gettext('name'), validators=[DataRequired(),Length(min=1, max=255) ])
2023-10-22 17:45:37 +00:00
scopes = StringField(gettext('scopes'), validators=[DataRequired(),Length(min=1, max=255) ])
2022-07-15 08:53:06 +00:00
submit = SubmitField(gettext('Activate'))
class AppTokenDeleteForm(FlaskForm):
submit = SubmitField(gettext('Delete'))
2023-12-25 18:44:38 +00:00
class PasskeyRegisterForm(FlaskForm):
"""Passkey register form"""
2022-04-08 19:28:22 +00:00
2023-12-25 18:44:38 +00:00
name = StringField('Name', [Length(max=50)])
2022-04-08 19:28:22 +00:00
submit = SubmitField('Register', render_kw={'disabled': True})
class PasswordChangeForm(FlaskForm):
password_old = PasswordField(gettext('Old Password'), validators=[DataRequired()])
password_new = PasswordField(gettext('New Password'), validators=[DataRequired()])
password_repeat = PasswordField(gettext('Repeat Password'), validators=[DataRequired(),EqualTo('password_new')])
submit = SubmitField(gettext('Change Password'))
class OidcAuthenticationConfirm(FlaskForm):
submit = SubmitField(gettext('Continue'))