diff --git a/config.yml b/config.yml index 6288234..182eb4f 100644 --- a/config.yml +++ b/config.yml @@ -1,6 +1,6 @@ auth: username: admin - hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1 + hashedPassword: pbkdf2:sha256:260000$2xn3u8v9EFHM7oj1$65a9126ae01129a8adc5ca74ec6c006388f3d7f0176d015dccf8e0bf1f5e2523 prod: False basePath: './' outputPath: './output' diff --git a/config_prod.yml b/config_prod.yml index b010300..3eb247b 100644 --- a/config_prod.yml +++ b/config_prod.yml @@ -1,6 +1,6 @@ auth: username: admin - hashedPassword: pbkdf2:sha256:150000$gWnHgdeJ$778d54af56408b434fdd7151f4d8ea88e1ad7525d47326aa70671962e1f654a1 + hashedPassword: pbkdf2:sha256:260000$2xn3u8v9EFHM7oj1$65a9126ae01129a8adc5ca74ec6c006388f3d7f0176d015dccf8e0bf1f5e2523 prod: True basePath: './csv-to-marp-converter' outputPath: './csv-to-marp-converter/output' diff --git a/converter.py b/converter.py index 71381eb..2c96744 100644 --- a/converter.py +++ b/converter.py @@ -63,6 +63,8 @@ def write_markdown_file(csv_path): # copy template template_name = "quiz-slides-template.md" template_path = os.path.join(BASE_FODLER, template_name) + # print("template_path") + # print(template_path) shutil.copyfile(template_path, markdown_path) diff --git a/requirements.txt b/requirements.txt index 0a1ef9d..f424f82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ colorama==0.4.4 docker==5.0.0 Flask==2.0.1 Flask-Cors==3.0.10 +Flask-HTTPAuth==4.3.0 idna==3.2 importlib-metadata==4.5.0 itsdangerous==2.0.1 diff --git a/rest_server.py b/rest_server.py index ff6cf1e..480715a 100644 --- a/rest_server.py +++ b/rest_server.py @@ -5,9 +5,8 @@ from flask import render_template from flask import request, send_from_directory from flask import url_for from flask_cors import CORS -# from flask_httpauth import HTTPBasicAuth -# from werkzeug.security import check_password_hash -# import main +from flask_httpauth import HTTPBasicAuth +from werkzeug.security import check_password_hash from werkzeug.utils import redirect # import config_parser @@ -15,21 +14,11 @@ from werkzeug.utils import redirect import converter app = Flask(__name__) -# auth = HTTPBasicAuth() +auth = HTTPBasicAuth() app.config["DEBUG"] = True CORS(app) 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 @@ -42,7 +31,15 @@ OUTPUT_FODLER = config_parser.output_path # 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"]) +@auth.login_required def upload_image(): if request.method == "POST": if request.files: