mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-06 21:16:21 -06:00
Implement CSRF protection & error page
This commit is contained in:
15
forms.py
15
forms.py
@@ -1,9 +1,10 @@
|
||||
from wtforms import Form, BooleanField, StringField, PasswordField, TextAreaField, validators
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import BooleanField, StringField, PasswordField, TextAreaField, validators
|
||||
|
||||
from validators import NoProfanity
|
||||
|
||||
|
||||
class RegistrationForm(Form):
|
||||
class RegistrationForm(FlaskForm):
|
||||
username = StringField('Username', [validators.Length(min=4, max=25), NoProfanity()])
|
||||
name = StringField('Name', [validators.Length(min=2, max=35), NoProfanity()])
|
||||
password = PasswordField('New Password', [
|
||||
@@ -14,20 +15,20 @@ class RegistrationForm(Form):
|
||||
accept_tos = BooleanField('I accept the TOS', [validators.DataRequired()])
|
||||
|
||||
|
||||
class LoginForm(Form):
|
||||
class LoginForm(FlaskForm):
|
||||
username = StringField('Username', [validators.DataRequired()])
|
||||
password = StringField('Password', [validators.DataRequired()])
|
||||
remember_me = BooleanField('Remember Me', [validators.Optional()])
|
||||
|
||||
|
||||
class EditProfileForm(Form):
|
||||
class EditProfileForm(FlaskForm):
|
||||
name = RegistrationForm.name
|
||||
about_me = StringField('About Me', [validators.Optional(), NoProfanity()], description='Tell us about yourself',)
|
||||
about_me = TextAreaField('About Me', [validators.Optional(), NoProfanity()], description='Tell us about yourself',)
|
||||
|
||||
|
||||
class NewPostForm(Form):
|
||||
class NewPostForm(FlaskForm):
|
||||
text = TextAreaField('Text', [validators.Length(min=15, max=1000), NoProfanity()], description='Express yourself.')
|
||||
|
||||
|
||||
class NewCommentForm(Form):
|
||||
class NewCommentForm(FlaskForm):
|
||||
text = StringField('Text', [validators.Length(min=5, max=50), NoProfanity()])
|
||||
|
||||
Reference in New Issue
Block a user