Open ScottPriestley opened 2 years ago
Thanks - would you mind submitting a pull request?
Im sorry - Im such a noob that I dont know how to issue a pull request....
On Sun, May 1, 2022 at 11:42 AM anfederico @.***> wrote:
Thanks - would you mind submitting a pull request?
— Reply to this email directly, view it on GitHub https://github.com/anfederico/flaskex/issues/34#issuecomment-1114268302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYQB3RZRMD7YNTQ4DNPPOY3VH2Q45ANCNFSM5UXS5IOA . You are receiving this because you authored the thread.Message ID: @.***>
I was not able to get the code to work with the above solution, but after checking wtforms documentation, this worked:
REPLACE THE FOLLOWING:
class LoginForm(Form): username = StringField('Username:', validators=[validators.required(), validators.Length(min=1, max=30)]) password = StringField('Password:', validators=[validators.required(), validators.Length(min=1, max=30)]) email = StringField('Email:', validators=[validators.optional(), validators.Length(min=0, max=50)])
WITH:
class LoginForm(Form): username = StringField('Username:', validators=[validators.InputRequired(), validators.Length(min=5, max=30)]) password = StringField('Password:', validators=[validators.InputRequired(), validators.Length(min=5, max=30)]) email = StringField('Email:', validators=[validators.Length(min=0, max=30)])
The code in forms.py needs updated as below due to changes in form validation from WTForms.
Replace:
-- coding: utf-8 --
from wtforms import Form, StringField, validators
class LoginForm(Form): username = StringField('Username:', validators=[validators.required(), validators.Length(min=1, max=30)]) password = StringField('Password:', validators=[validators.required(), validators.Length(min=1, max=30)]) email = StringField('Email:', validators=[validators.optional(), validators.Length(min=0, max=50)])
With:
-- coding: utf-8 --
from wtforms import Form
from wtforms import (StringField) from wtforms.validators import InputRequired, Length
class LoginForm(Form): username = StringField('Username:', validators=[InputRequired(), Length(min=5, max=30)]) password = StringField('Password:', validators=[InputRequired(), Length(min=5, max=30)]) email = StringField('Email:', validators=[Length(min=0, max=30)])