wip: add password in configuration

This commit is contained in:
Mylloon 2023-12-21 21:25:18 +01:00
parent 236fd36219
commit 3930abc6f2
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 11 additions and 4 deletions

View file

@ -1,22 +1,27 @@
from os import environ as envar from os import environ as envar
VAR_USERNAME = "TD_USERNAME" VAR_USERNAME = "TD_USERNAME"
VAR_USERPASS = "TD_USERPASS"
class User: class User:
"""user informations""" """user informations"""
# user name
name = envar[VAR_USERNAME] if VAR_USERNAME in envar else None name = envar[VAR_USERNAME] if VAR_USERNAME in envar else None
# user password
password = envar[VAR_USERPASS]
class Config: class Config:
"""app configuration""" """app configuration"""
# App name # app name
name = "txtdiary" name = "txtdiary"
# App description # app description
description = "Personal diary page" description = "Personal diary page"
# User # user
user = User user = User

View file

@ -19,4 +19,6 @@ def login() -> str:
@router.route(f"/{name}", methods=["POST"]) @router.route(f"/{name}", methods=["POST"])
def check() -> Response: def check() -> Response:
"""Login logic""" """Login logic"""
return jsonify("{}") # TODO: Check password with the configuration
# TODO: Store a cookie
return jsonify({"pass": Config.user.password})