Skip to content

Commit

Permalink
Allow loading fonts from google, remove flask-seasurf
Browse files Browse the repository at this point in the history
  • Loading branch information
chr-peters committed Mar 18, 2021
1 parent 922dd30 commit e6b71dd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
6 changes: 1 addition & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ brotli==1.0.9
# via strong-but-simple-passwords (setup.py)
click==7.1.2
# via flask
flask-seasurf==0.3.0
# via strong-but-simple-passwords (setup.py)
flask-talisman==0.7.0
# via strong-but-simple-passwords (setup.py)
flask==1.1.2
# via
# flask-seasurf
# strong-but-simple-passwords (setup.py)
# via strong-but-simple-passwords (setup.py)
gunicorn==20.0.4
# via strong-but-simple-passwords (setup.py)
itsdangerous==1.1.0
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
install_requires=[
"flask",
"flask-talisman",
"flask-seasurf",
"whitenoise",
"brotli",
"gunicorn",
Expand Down
10 changes: 5 additions & 5 deletions strong_but_simple_passwords/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from flask import Flask
from flask_talisman import Talisman
from flask_seasurf import SeaSurf
from whitenoise import WhiteNoise
from pathlib import Path
from .config import get_config_from_env_vars
Expand All @@ -18,15 +17,16 @@ def create_app(config=None):

app.add_url_rule("/", "index", view_func=views.index, methods=("GET", "POST"))

# add CSRF protection
SeaSurf(app)

# use whitenoise to serve static files
static_root = Path(__file__).parent / "static/"
app.wsgi_app = WhiteNoise(app.wsgi_app, root=static_root, prefix="static/")

# disable force_https during testing
force_https = not app.config["TESTING"]
Talisman(app, force_https=force_https)

# allow to load fonts from google
csp = {"default-src": ["'self'", "*.googleapis.com", "*.gstatic.com"]}

Talisman(app, force_https=force_https, content_security_policy=csp)

return app
1 change: 0 additions & 1 deletion strong_but_simple_passwords/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ <h3>2. Only keep the first 3 letters of each word</h3>
<h3>3. Put a random symbol somewhere in between</h3>
</li>
</ol>
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
<button type="submit">Generate password!</button>
</form>
</main>
Expand Down

0 comments on commit e6b71dd

Please sign in to comment.