|
|
|
"""Register form to make a new user."""
|
|
|
|
|
|
|
|
from flask_wtf import FlaskForm
|
|
|
|
from wtforms import PasswordField, StringField, SubmitField, validators
|
|
|
|
from wtforms.validators import Email, EqualTo, Length, ValidationError
|
|
|
|
|
|
|
|
|
|
|
|
class RegisterForm(FlaskForm):
|
|
|
|
"""Register for distribusi-verse form class"""
|
|
|
|
|
|
|
|
username = StringField(
|
|
|
|
"Username:",
|
|
|
|
validators=[validators.InputRequired(), Length(3, 150)],
|
|
|
|
)
|
|
|
|
|
|
|
|
email = StringField(
|
|
|
|
"Email address:",
|
|
|
|
validators=[
|
|
|
|
validators.InputRequired(),
|
|
|
|
Email(),
|
|
|
|
Length(6, 128),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
password = PasswordField(
|
|
|
|
"New password:",
|
|
|
|
validators=[validators.InputRequired(), Length(12, 72)],
|
|
|
|
)
|
|
|
|
|
|
|
|
confirmpassword = PasswordField(
|
|
|
|
"Confirm your password:",
|
|
|
|
validators=[
|
|
|
|
validators.InputRequired(),
|
|
|
|
Length(12, 72),
|
|
|
|
EqualTo("password", message="Passwords must match !"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
submit = SubmitField("Register to Distribusi-verse")
|