diff --git a/backend/requirements.txt b/backend/requirements.txt index 5774964..7ead743 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -3,3 +3,4 @@ cryptography flask gunicorn ldap3 +wtforms diff --git a/backend/src/app.py b/backend/src/app.py index 6a23b0a..874c772 100644 --- a/backend/src/app.py +++ b/backend/src/app.py @@ -1,9 +1,19 @@ import logging from flask import Flask, render_template +from forms import UserLookupForm app = Flask(__name__) app.logger.setLevel(logging.INFO) @app.route('/') def index(): - return render_template('landing.html') + if request.method == 'POST': + form = UserLookupForm(request.form) + if form.validate(): + email = form.email.data + else: + app.logger.warn('Form validation failed') + else: + form = UserLookupForm(request.args) + + return render_template('landing.html', form=form) diff --git a/backend/src/forms.py b/backend/src/forms.py new file mode 100644 index 0000000..48058a9 --- /dev/null +++ b/backend/src/forms.py @@ -0,0 +1,4 @@ +from wtforms import Form, StringField, validators + +class UserLookupForm(Form): + email = StringField('Email Address', [validators.Email()]) diff --git a/backend/src/templates/landing.html b/backend/src/templates/landing.html index 2016d16..48cc565 100644 --- a/backend/src/templates/landing.html +++ b/backend/src/templates/landing.html @@ -4,5 +4,12 @@

FileDrop App

Form to select and upload files will go here. +
+
+
{{ form.email.label }}
+
{{ form.email()|safe }}
+
+ +
{% endblock %}