use basic auth
This commit is contained in:
parent
7a5698467f
commit
dbe862cf53
@ -1,6 +1,6 @@
|
|||||||
auth:
|
auth:
|
||||||
username: admin
|
username: admin
|
||||||
hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
|
hashedPassword: pbkdf2:sha256:260000$2xn3u8v9EFHM7oj1$65a9126ae01129a8adc5ca74ec6c006388f3d7f0176d015dccf8e0bf1f5e2523
|
||||||
prod: False
|
prod: False
|
||||||
basePath: './'
|
basePath: './'
|
||||||
outputPath: './output'
|
outputPath: './output'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
auth:
|
auth:
|
||||||
username: admin
|
username: admin
|
||||||
hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1
|
hashedPassword: pbkdf2:sha256:260000$2xn3u8v9EFHM7oj1$65a9126ae01129a8adc5ca74ec6c006388f3d7f0176d015dccf8e0bf1f5e2523
|
||||||
prod: True
|
prod: True
|
||||||
basePath: './csv-to-marp-converter'
|
basePath: './csv-to-marp-converter'
|
||||||
outputPath: './csv-to-marp-converter/output'
|
outputPath: './csv-to-marp-converter/output'
|
||||||
|
@ -63,6 +63,8 @@ def write_markdown_file(csv_path):
|
|||||||
# copy template
|
# copy template
|
||||||
template_name = "quiz-slides-template.md"
|
template_name = "quiz-slides-template.md"
|
||||||
template_path = os.path.join(BASE_FODLER, template_name)
|
template_path = os.path.join(BASE_FODLER, template_name)
|
||||||
|
# print("template_path")
|
||||||
|
# print(template_path)
|
||||||
|
|
||||||
shutil.copyfile(template_path, markdown_path)
|
shutil.copyfile(template_path, markdown_path)
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ colorama==0.4.4
|
|||||||
docker==5.0.0
|
docker==5.0.0
|
||||||
Flask==2.0.1
|
Flask==2.0.1
|
||||||
Flask-Cors==3.0.10
|
Flask-Cors==3.0.10
|
||||||
|
Flask-HTTPAuth==4.3.0
|
||||||
idna==3.2
|
idna==3.2
|
||||||
importlib-metadata==4.5.0
|
importlib-metadata==4.5.0
|
||||||
itsdangerous==2.0.1
|
itsdangerous==2.0.1
|
||||||
|
@ -5,9 +5,8 @@ from flask import render_template
|
|||||||
from flask import request, send_from_directory
|
from flask import request, send_from_directory
|
||||||
from flask import url_for
|
from flask import url_for
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
# from flask_httpauth import HTTPBasicAuth
|
from flask_httpauth import HTTPBasicAuth
|
||||||
# from werkzeug.security import check_password_hash
|
from werkzeug.security import check_password_hash
|
||||||
# import main
|
|
||||||
from werkzeug.utils import redirect
|
from werkzeug.utils import redirect
|
||||||
|
|
||||||
# import config_parser
|
# import config_parser
|
||||||
@ -15,21 +14,11 @@ from werkzeug.utils import redirect
|
|||||||
import converter
|
import converter
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
# auth = HTTPBasicAuth()
|
auth = HTTPBasicAuth()
|
||||||
app.config["DEBUG"] = True
|
app.config["DEBUG"] = True
|
||||||
CORS(app)
|
CORS(app)
|
||||||
|
|
||||||
URL_BASE_PATH = "/"
|
URL_BASE_PATH = "/"
|
||||||
# URL_BASE_PATH = "/tagebuch"
|
|
||||||
|
|
||||||
# @auth.verify_password
|
|
||||||
# def verify_password(username, password):
|
|
||||||
# if username == config_parser.credentials['username'] and \
|
|
||||||
# check_password_hash(config_parser.credentials['hashedPassword'], password):
|
|
||||||
# return username
|
|
||||||
|
|
||||||
# OUTPUT_FODLER = "output"
|
|
||||||
# UPLOAD_FODLER = "upload"
|
|
||||||
|
|
||||||
import config_parser
|
import config_parser
|
||||||
|
|
||||||
@ -42,7 +31,15 @@ OUTPUT_FODLER = config_parser.output_path
|
|||||||
# return render_template("index.html")
|
# return render_template("index.html")
|
||||||
|
|
||||||
|
|
||||||
|
@auth.verify_password
|
||||||
|
def verify_password(username, password):
|
||||||
|
if username == config_parser.credentials['username'] and \
|
||||||
|
check_password_hash(config_parser.credentials['hashedPassword'], password):
|
||||||
|
return username
|
||||||
|
|
||||||
|
|
||||||
@app.route(URL_BASE_PATH, methods=["GET", "POST"])
|
@app.route(URL_BASE_PATH, methods=["GET", "POST"])
|
||||||
|
@auth.login_required
|
||||||
def upload_image():
|
def upload_image():
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
if request.files:
|
if request.files:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user