lenticular_cloud2/lenticular_cloud/form/auth.py

41 lines
1.5 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, \
2022-04-08 19:28:22 +00:00
SelectField, Form as NoCsrfForm, SelectMultipleField, \
HiddenField
2022-06-17 07:25:14 +00:00
from wtforms.fields import EmailField
from wtforms.widgets import NumberInput, DateInput
2022-04-08 19:28:22 +00:00
from wtforms.validators import DataRequired, NumberRange, Optional, NoneOf, Length, Regexp, InputRequired
2020-05-09 18:00:07 +00:00
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 ConsentForm(FlaskForm):
# scopes = SelectMultipleField(gettext('scopes'))
# audiences = SelectMultipleField(gettext('audiences'))
remember = BooleanField(gettext('remember'))
submit = SubmitField()
2020-05-27 19:16:14 +00:00
class RegistrationForm(FlaskForm):
username = StringField(gettext('Username'), validators=[
DataRequired(),
2024-01-02 17:07:55 +00:00
Regexp('^[a-z0-9-.]+$', message=gettext('Only `a-z`, `0-9`, `-.` is allowed for username'))
])
password = PasswordField(gettext('Password'), validators=[
DataRequired(),
Length(min=6)
])
alternative_email = EmailField(gettext('Alternative Email'), render_kw={"placeholder": "Optional"})
2020-05-27 19:16:14 +00:00
submit = SubmitField()