route admin

pull/6/head
Yax 3 years ago
parent 2e74425108
commit 1ae37ff18e

@ -105,9 +105,9 @@ def stacosys_server(config_pathname):
)
# inject config parameters into flask
app.config.update(SITE_REDIRECT=conf.get(ConfigParameter.SITE_REDIRECT))
app.config.update(SITE_URL=conf.get(ConfigParameter.SITE_URL))
app.config.update(LANG=conf.get(ConfigParameter.LANG))
app.config.update(SITE_URL=conf.get(ConfigParameter.SITE_URL))
app.config.update(SITE_REDIRECT=conf.get(ConfigParameter.SITE_REDIRECT))
app.config.update(WEB_USERNAME=conf.get(ConfigParameter.WEB_USERNAME))
app.config.update(WEB_PASSWORD=conf.get(ConfigParameter.WEB_PASSWORD))
logger.info(f"start interfaces {api} {form} {admin}")

@ -11,6 +11,14 @@ from stacosys.interface import app
logger = logging.getLogger(__name__)
app.add_url_rule("/web", endpoint="index")
app.add_url_rule("/web/", endpoint="index")
@app.endpoint("index")
def index():
return redirect('/web/admin')
def is_login_ok(username, password):
hashed = hashlib.sha256(password.encode()).hexdigest().upper()
@ -35,7 +43,7 @@ def login():
@app.route('/web/logout', methods=["GET"])
def logout():
session.pop('user')
return redirect('/web/login')
return redirect('/web/admin')
@app.route("/web/admin", methods=["GET"])
@ -52,4 +60,6 @@ def admin_homepage():
@app.route("/web/admin", methods=["POST"])
def admin_action():
flash(request.form.get("comment") + " " + request.form.get("action"))
# rebuild RSS
#rss.generate()
return redirect('/web/admin')

Loading…
Cancel
Save