crunk
6 months ago
7 changed files with 97 additions and 3 deletions
@ -0,0 +1,15 @@ |
|||||
|
"""Forgotten password form to help user.""" |
||||
|
|
||||
|
from flask_wtf import FlaskForm |
||||
|
from wtforms import StringField, SubmitField, validators |
||||
|
from wtforms.validators import Email, Length |
||||
|
|
||||
|
|
||||
|
class ForgotPasswordForm(FlaskForm): |
||||
|
"""Forgotten password distribusiverse form class.""" |
||||
|
|
||||
|
email = StringField( |
||||
|
"Email address:", |
||||
|
validators=[validators.InputRequired(), Email(), Length(6, 64)], |
||||
|
) |
||||
|
submit = SubmitField("Send email") |
@ -0,0 +1,18 @@ |
|||||
|
"""Login form to validate user.""" |
||||
|
|
||||
|
from flask_wtf import FlaskForm |
||||
|
from wtforms import PasswordField, StringField, SubmitField, validators |
||||
|
from wtforms.validators import Email, Length |
||||
|
|
||||
|
|
||||
|
class LoginForm(FlaskForm): |
||||
|
"""Login distribusiverse form class.""" |
||||
|
|
||||
|
email = StringField( |
||||
|
"Email address:", |
||||
|
validators=[validators.InputRequired(), Email(), Length(6, 64)], |
||||
|
) |
||||
|
password = PasswordField( |
||||
|
"Password:", validators=[validators.InputRequired()] |
||||
|
) |
||||
|
submit = SubmitField("Sign In") |
@ -0,0 +1,38 @@ |
|||||
|
"""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 |
||||
|
|
||||
|
|
||||
|
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") |
@ -0,0 +1,23 @@ |
|||||
|
"""Reset Password Form form to reset a users PasswordField.""" |
||||
|
|
||||
|
from flask_wtf import FlaskForm |
||||
|
from wtforms import PasswordField, SubmitField, validators |
||||
|
from wtforms.validators import EqualTo, Length |
||||
|
|
||||
|
|
||||
|
class ResetPasswordForm(FlaskForm): |
||||
|
"""ResetPassword for distribusi-verse form class""" |
||||
|
|
||||
|
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("Reset your password") |
Loading…
Reference in new issue