Browse Source

refactor: moved user forms to statuspengguna folder

pull/12/head
crunk 6 months ago
parent
commit
280ce2f196
  1. 15
      verse/statuspengguna/forms/forgotpasswordform.py
  2. 18
      verse/statuspengguna/forms/loginform.py
  3. 38
      verse/statuspengguna/forms/registerform.py
  4. 23
      verse/statuspengguna/forms/resetpasswordform.py
  5. 2
      verse/statuspengguna/loginuser.py
  6. 2
      verse/statuspengguna/registeruser.py
  7. 2
      verse/statuspengguna/resetpassword.py

15
verse/statuspengguna/forms/forgotpasswordform.py

@ -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

@ -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

@ -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

@ -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")

2
verse/statuspengguna/loginuser.py

@ -10,7 +10,7 @@ from flask import (
from flask_bcrypt import check_password_hash
from flask_login import login_user
from forms.loginform import LoginForm
from statuspengguna.forms.loginform import LoginForm
from models.user_model import User
login_section = Blueprint(

2
verse/statuspengguna/registeruser.py

@ -11,7 +11,7 @@ from sqlalchemy.exc import (
from werkzeug.routing import BuildError
from app import db
from forms.registerform import RegisterForm
from statuspengguna.forms.registerform import RegisterForm
from models.user_model import User
register_user = Blueprint(

2
verse/statuspengguna/resetpassword.py

@ -13,7 +13,7 @@ from sqlalchemy.exc import (
from werkzeug.routing import BuildError
from app import db
from forms.resetpasswordform import ResetPasswordForm
from statuspengguna.forms.resetpasswordform import ResetPasswordForm
from models.user_model import User
reset_password = Blueprint(

Loading…
Cancel
Save