mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-08 06:08:19 -06:00
Implement new Profanity Checker on Form Validation
Why am I still up doing this at 3am
This commit is contained in:
12
forms.py
12
forms.py
@@ -1,9 +1,11 @@
|
||||
from wtforms import Form, BooleanField, StringField, PasswordField, validators
|
||||
|
||||
from validators import NoProfanity
|
||||
|
||||
|
||||
class RegistrationForm(Form):
|
||||
username = StringField('Username', [validators.Length(min=4, max=25)])
|
||||
name = StringField('Name', [validators.Length(min=2, max=35)])
|
||||
username = StringField('Username', [validators.Length(min=4, max=25), NoProfanity()])
|
||||
name = StringField('Name', [validators.Length(min=2, max=35), NoProfanity()])
|
||||
password = PasswordField('New Password', [
|
||||
validators.DataRequired(),
|
||||
validators.EqualTo('confirm', message='Passwords must match')
|
||||
@@ -20,12 +22,12 @@ class LoginForm(Form):
|
||||
|
||||
class EditProfileForm(Form):
|
||||
name = RegistrationForm.name
|
||||
about_me = StringField('About Me', [validators.Optional()])
|
||||
about_me = StringField('About Me', [validators.Optional(), NoProfanity()])
|
||||
|
||||
|
||||
class NewPostForm(Form):
|
||||
text = StringField('Text', [validators.Length(min=15, max=1000)])
|
||||
text = StringField('Text', [validators.Length(min=15, max=1000), NoProfanity()])
|
||||
|
||||
|
||||
class NewCommentForm(Form):
|
||||
text = StringField('Text', [validators.Length(min=5, max=50)])
|
||||
text = StringField('Text', [validators.Length(min=5, max=50), NoProfanity()])
|
||||
|
||||
Reference in New Issue
Block a user