You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

from flask_wtf import FlaskForm
from wtforms import PasswordField, StringField, SubmitField, ValidationError
from wtforms.validators import DataRequired, EqualTo
from models import User
class RegistrationForm(FlaskForm):
username = StringField("Username", validators=[DataRequired()])
password = PasswordField(
password2 = PasswordField(
"Confirm Password",
validators=[DataRequired(), EqualTo("password", message="Passwords must match.")],
submit = SubmitField("Register")
def validate_username(self, field):
if User.query.filter_by(
raise ValidationError("Username already in use.")
class LoginForm(FlaskForm):
username = StringField("Username", validators=[DataRequired()])
password = PasswordField("Password", validators=[DataRequired()])
submit = SubmitField("Login")
class IdeaForm(FlaskForm):
name = StringField("Name", validators=[DataRequired()])
description = StringField("Description", validators=[DataRequired()])
submit = SubmitField("Save")