Update README and Flask-HTTPAuth
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-04-27 14:02:38 +02:00
parent c43f64e5c9
commit d7b0d5eba2
4 changed files with 7 additions and 7 deletions

View File

@ -20,10 +20,8 @@ After a good rewrite in Python, it's time to show it to the public, and here it
- Install Python 3: https://www.python.org/downloads/
- Install Pip: https://pip.pypa.io/en/stable/installing/
- Clone this repository
- Launch a terminal and move into the root of the cloned repository
- Run `pip install -r requirements.txt`
- Run `python3 run.py` or simply `pynyaata`
- Run `pip install pynyaata`
- Run `pynyaata`
- The app is accessible at http://localhost:5000
## Features

View File

@ -2,6 +2,7 @@ from functools import wraps
from operator import attrgetter, itemgetter
from flask import redirect, render_template, request, url_for, abort
from werkzeug.security import check_password_hash
from .config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED, APP_PORT, IS_DEBUG
from .connectors import *
@ -26,7 +27,7 @@ def mysql_required(f):
@auth.verify_password
def verify_password(username, password):
return username == ADMIN_USERNAME and password == ADMIN_PASSWORD
return username == ADMIN_USERNAME and check_password_hash(ADMIN_PASSWORD, password)
@app.template_filter('boldify')

View File

@ -4,12 +4,13 @@ from flask import Flask
from flask.cli import load_dotenv
from flask_httpauth import HTTPBasicAuth
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash
load_dotenv()
IS_DEBUG = environ.get('FLASK_ENV', 'production') == 'development'
ADMIN_USERNAME = environ.get('ADMIN_USERNAME', 'admin')
ADMIN_PASSWORD = environ.get('ADMIN_PASSWORD', 'secret')
ADMIN_PASSWORD = generate_password_hash(environ.get('ADMIN_PASSWORD', 'secret'))
APP_PORT = environ.get('FLASK_PORT', 5000)
CACHE_TIMEOUT = environ.get('CACHE_TIMEOUT', 60 * 60)
BLACKLIST_WORDS = environ.get('BLACKLIST_WORDS', '').split(',')

View File

@ -1,6 +1,6 @@
Flask==1.1.2
Flask-SQLAlchemy==2.4.1
Flask-HTTPAuth==3.3.0
Flask-HTTPAuth==4.0.0
Flask-WTF==0.14.3
WTForms==2.3.1
PyMySQL==0.9.3