diff --git a/app/app.py b/app/app.py index 72e04d2..86287e6 100644 --- a/app/app.py +++ b/app/app.py @@ -3,10 +3,12 @@ """Flask web server.""" from flask import Flask, render_template, request +from flask_wtf.csrf import CSRFProtect from app.send_page import send_page app = Flask(__name__) +csrf = CSRFProtect(app) @app.route("/", methods=['GET']) def index(): diff --git a/app/main.py b/app/main.py index 4c32c13..9d17ff9 100644 --- a/app/main.py +++ b/app/main.py @@ -2,11 +2,15 @@ """Main module.""" -from app.app import app +import os + +from app.app import app, csrf def main(): """Run the app.""" + app.secret_key = os.urandom(12).hex() + csrf.init_app(app) app.run() diff --git a/app/templates/index.html b/app/templates/index.html index 90057e6..51ec836 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -24,7 +24,7 @@