From 3930abc6f2372e287fef19177a6adda0c5fb364d Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 21 Dec 2023 21:25:18 +0100 Subject: [PATCH] wip: add password in configuration --- src/config.py | 11 ++++++++--- src/routes/login.py | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/config.py b/src/config.py index b882805..da43def 100644 --- a/src/config.py +++ b/src/config.py @@ -1,22 +1,27 @@ from os import environ as envar VAR_USERNAME = "TD_USERNAME" +VAR_USERPASS = "TD_USERPASS" class User: """user informations""" + # user name name = envar[VAR_USERNAME] if VAR_USERNAME in envar else None + # user password + password = envar[VAR_USERPASS] + class Config: """app configuration""" - # App name + # app name name = "txtdiary" - # App description + # app description description = "Personal diary page" - # User + # user user = User diff --git a/src/routes/login.py b/src/routes/login.py index 419519d..06fddbd 100644 --- a/src/routes/login.py +++ b/src/routes/login.py @@ -19,4 +19,6 @@ def login() -> str: @router.route(f"/{name}", methods=["POST"]) def check() -> Response: """Login logic""" - return jsonify("{}") + # TODO: Check password with the configuration + # TODO: Store a cookie + return jsonify({"pass": Config.user.password})