Features: - Added page for an overview of establishments with a possibility to request a membership. - Added page for admins of an establishment to accept or deny those candidates. This is currently only usable via URL, the navigation to this site is not yet implemented in the HTML files. - Added page to add new establishments by providing a name. Improvements: - Better folder structure. - The establishment-specific overview can now be viewed with another URL, as well as some other pages. Bugfixes: - Seriously I don't know anymore what I fixed and what not. But it works just better now :) Future: - Angular has been added to separate the Flask-Backend with the frontend. Angular is currently not connected to the backend, but this will change in the future.
37 lines
1.8 KiB
Python
37 lines
1.8 KiB
Python
from src.models.user import User
|
|
from flask_wtf import FlaskForm
|
|
from wtforms import BooleanField, PasswordField, StringField, SubmitField
|
|
from wtforms.validators import DataRequired, Email, EqualTo, ValidationError
|
|
|
|
class LoginForm(FlaskForm):
|
|
email = StringField('Email', validators=[DataRequired(), Email()])
|
|
password = PasswordField('Password', validators=[DataRequired()])
|
|
remember_me = BooleanField('Remember Me')
|
|
submit = SubmitField('Sign In', render_kw={"class": "btn btn-primary mt-3"})
|
|
|
|
class RegistrationForm(FlaskForm):
|
|
email = StringField('Email', validators=[DataRequired(), Email()])
|
|
password = PasswordField('Password', validators=[DataRequired()])
|
|
password2 = PasswordField(
|
|
'Repeat Password', validators=[DataRequired(), EqualTo('password')])
|
|
submit = SubmitField('Register', render_kw={"class": "btn btn-primary mt-3"})
|
|
|
|
def validate_username(self, username):
|
|
user = User.query.filter_by(username=username.data).first()
|
|
if user is not None:
|
|
raise ValidationError('Please use a different username.')
|
|
|
|
def validate_email(self, email):
|
|
user = User.query.filter_by(email=email.data).first()
|
|
if user is not None:
|
|
raise ValidationError('Please use a different email address.')
|
|
|
|
class ResetPasswordRequestForm(FlaskForm):
|
|
email = StringField('Email', validators=[DataRequired(), Email()])
|
|
submit = SubmitField('Request Password Reset', render_kw={"class": "btn btn-primary mt-3"})
|
|
|
|
class ResetPasswordForm(FlaskForm):
|
|
password = PasswordField('Password', validators=[DataRequired()])
|
|
password2 = PasswordField(
|
|
'Repeat Password', validators=[DataRequired(), EqualTo('password')])
|
|
submit = SubmitField('Request Password Reset', render_kw={"class": "btn btn-primary mt-3"}) |