Skip to content
Permalink
Browse files Browse the repository at this point in the history
haha actually use csrf
  • Loading branch information
katlings committed Sep 19, 2021
1 parent 1017b9d commit 974f21a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app.py
@@ -1,5 +1,6 @@
import logging
from logging.handlers import RotatingFileHandler
import os
import random
import re

Expand All @@ -13,7 +14,8 @@
pm.setup()

app = Flask(__name__)
app.config.update(WTF_CSRF_ENABLED=False)
SECRET_KEY = os.urandom(32)
app.config['SECRET_KEY'] = SECRET_KEY

handler = RotatingFileHandler('poems.log', maxBytes=10000, backupCount=1)
handler.setLevel(logging.INFO)
Expand Down
1 change: 1 addition & 0 deletions templates/custom.html
Expand Up @@ -13,6 +13,7 @@
<div class="row my-5 text-center">
<div class="col">
<form action="" method="POST">
{{ form.csrf_token }}
<div class="form-group my-3">
<label for="source_text" class="mb-3">Copy-paste your text! The longer it is, the better and more varied results will be. It will be sanitized with most punctuation and all capitalization and whitespace stripped.</label>
{{ form.source_text }}
Expand Down
1 change: 1 addition & 0 deletions templates/custom_poem.html
Expand Up @@ -18,6 +18,7 @@
<div class="row my-5 text-center">
<div class="col">
<form action="" method="POST">
{{ form.csrf_token }}
{{ form.source_text }}
<div class="form-group my-3">
I want a {{ form.poem_format }}
Expand Down
1 change: 1 addition & 0 deletions templates/generate.html
Expand Up @@ -20,6 +20,7 @@
<div class="row my-3">
<div class="col">
<form action="" method="POST">
{{ form.csrf_token }}
<h5>
I want a {{ form.style }} in the style of {{ form.source }}
<input type='submit' value='go'>
Expand Down

0 comments on commit 974f21a

Please sign in to comment.