refactor: moved user forms to statuspengguna folder
This commit is contained in:
parent
b5c9bfc8d7
commit
280ce2f196
15
verse/statuspengguna/forms/forgotpasswordform.py
Normal file
15
verse/statuspengguna/forms/forgotpasswordform.py
Normal file
@ -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")
|
18
verse/statuspengguna/forms/loginform.py
Normal file
18
verse/statuspengguna/forms/loginform.py
Normal file
@ -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")
|
38
verse/statuspengguna/forms/registerform.py
Normal file
38
verse/statuspengguna/forms/registerform.py
Normal file
@ -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")
|
23
verse/statuspengguna/forms/resetpasswordform.py
Normal file
23
verse/statuspengguna/forms/resetpasswordform.py
Normal file
@ -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")
|
@ -10,7 +10,7 @@ from flask import (
|
|||||||
from flask_bcrypt import check_password_hash
|
from flask_bcrypt import check_password_hash
|
||||||
from flask_login import login_user
|
from flask_login import login_user
|
||||||
|
|
||||||
from forms.loginform import LoginForm
|
from statuspengguna.forms.loginform import LoginForm
|
||||||
from models.user_model import User
|
from models.user_model import User
|
||||||
|
|
||||||
login_section = Blueprint(
|
login_section = Blueprint(
|
||||||
|
@ -11,7 +11,7 @@ from sqlalchemy.exc import (
|
|||||||
from werkzeug.routing import BuildError
|
from werkzeug.routing import BuildError
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from forms.registerform import RegisterForm
|
from statuspengguna.forms.registerform import RegisterForm
|
||||||
from models.user_model import User
|
from models.user_model import User
|
||||||
|
|
||||||
register_user = Blueprint(
|
register_user = Blueprint(
|
||||||
|
@ -13,7 +13,7 @@ from sqlalchemy.exc import (
|
|||||||
from werkzeug.routing import BuildError
|
from werkzeug.routing import BuildError
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from forms.resetpasswordform import ResetPasswordForm
|
from statuspengguna.forms.resetpasswordform import ResetPasswordForm
|
||||||
from models.user_model import User
|
from models.user_model import User
|
||||||
|
|
||||||
reset_password = Blueprint(
|
reset_password = Blueprint(
|
||||||
|
Loading…
Reference in New Issue
Block a user