2021-09-01 12:55:44 +02:00
from flask_wtf import FlaskForm
2021-09-02 01:47:37 +02:00
from wtforms import StringField , PasswordField , SubmitField , RadioField
2021-09-01 12:55:44 +02:00
from wtforms . validators import DataRequired , Length , EqualTo , Email
2021-09-02 01:47:37 +02:00
class OptionForm ( FlaskForm ) :
option = RadioField ( ' Label ' , choices = [ ( ' mail-old ' , ' I want to use an existing email address. ' ) , ( ' mail-new ' , ' I want to create and use a new email address. ' ) ] )
submit = SubmitField ( ' Save preference ' )
2021-09-01 12:55:44 +02:00
class RegistrationForm ( FlaskForm ) :
username = StringField ( ' Username ' , validators = [ DataRequired ( ) , Length ( min = 1 , max = 32 ) ] )
email = StringField ( ' Email ' , validators = [ DataRequired ( ) , Email ( ) ] )
password = PasswordField ( ' Password ' , validators = [ DataRequired ( ) ] )
confirm_password = PasswordField ( ' Confirm Password ' , validators = [ DataRequired ( ) , EqualTo ( ' password ' ) ] )
submit = SubmitField ( ' Register ' )
#class VerificationForm(FlaskForm):
# username = StringField('Username', validators=[DataRequired(), Length(min=1, max=32)])
# verif_code = StringField('Verification Code', validators=[DataRequired()])
# submit = SubmitField('Verify')