Read users from config!
This commit is contained in:
parent
7cca8cd232
commit
26c6e7771b
@ -10,6 +10,7 @@ from flask import (
|
|||||||
)
|
)
|
||||||
from werkzeug.security import check_password_hash, generate_password_hash
|
from werkzeug.security import check_password_hash, generate_password_hash
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from squirrel.conf import settings
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
bp = Blueprint("auth", __name__, url_prefix="/auth")
|
bp = Blueprint("auth", __name__, url_prefix="/auth")
|
||||||
@ -22,14 +23,7 @@ class User:
|
|||||||
repos: list[str] | None = None
|
repos: list[str] | None = None
|
||||||
|
|
||||||
|
|
||||||
users: dict[str, dict] = {
|
users = settings["users"]
|
||||||
"guest": {"password": "x", "name": "Guest"},
|
|
||||||
"tris": {
|
|
||||||
"password": "scrypt:32768:8:1$4srkVJ5rxSAvZp8s$6a9b1bd9199ceb07a8e650897d6ca0c229330773a77728f83c110525c0cde5c9a019bcafbfd0274a2e532e6db03996ff34521d8f36758f4892bcc13107ac24e5",
|
|
||||||
"name": "Tris",
|
|
||||||
"repos": ["test"],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/login", methods=("GET", "POST"))
|
@bp.route("/login", methods=("GET", "POST"))
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
from squirrel.repo import get_archive
|
from squirrel.repo import get_archive
|
||||||
import shutil
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
archive = get_archive()
|
archive = get_archive()
|
||||||
@ -13,5 +12,5 @@ def reindex():
|
|||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
p = archive.reindex(options.repo)
|
p = archive.reindex(options.repo)
|
||||||
for line in p.stderr:
|
for line in p.stderr: # type:ignore
|
||||||
sys.stderr.write(line.decode("utf8"))
|
sys.stderr.write(line.decode("utf8"))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user