route admin
This commit is contained in:
parent
2e74425108
commit
1ae37ff18e
2 changed files with 13 additions and 3 deletions
4
run.py
4
run.py
|
@ -105,9 +105,9 @@ def stacosys_server(config_pathname):
|
||||||
)
|
)
|
||||||
|
|
||||||
# inject config parameters into flask
|
# 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(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_USERNAME=conf.get(ConfigParameter.WEB_USERNAME))
|
||||||
app.config.update(WEB_PASSWORD=conf.get(ConfigParameter.WEB_PASSWORD))
|
app.config.update(WEB_PASSWORD=conf.get(ConfigParameter.WEB_PASSWORD))
|
||||||
logger.info(f"start interfaces {api} {form} {admin}")
|
logger.info(f"start interfaces {api} {form} {admin}")
|
||||||
|
|
|
@ -11,6 +11,14 @@ from stacosys.interface import app
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
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):
|
def is_login_ok(username, password):
|
||||||
hashed = hashlib.sha256(password.encode()).hexdigest().upper()
|
hashed = hashlib.sha256(password.encode()).hexdigest().upper()
|
||||||
|
@ -35,7 +43,7 @@ def login():
|
||||||
@app.route('/web/logout', methods=["GET"])
|
@app.route('/web/logout', methods=["GET"])
|
||||||
def logout():
|
def logout():
|
||||||
session.pop('user')
|
session.pop('user')
|
||||||
return redirect('/web/login')
|
return redirect('/web/admin')
|
||||||
|
|
||||||
|
|
||||||
@app.route("/web/admin", methods=["GET"])
|
@app.route("/web/admin", methods=["GET"])
|
||||||
|
@ -52,4 +60,6 @@ def admin_homepage():
|
||||||
@app.route("/web/admin", methods=["POST"])
|
@app.route("/web/admin", methods=["POST"])
|
||||||
def admin_action():
|
def admin_action():
|
||||||
flash(request.form.get("comment") + " " + request.form.get("action"))
|
flash(request.form.get("comment") + " " + request.form.get("action"))
|
||||||
|
# rebuild RSS
|
||||||
|
#rss.generate()
|
||||||
return redirect('/web/admin')
|
return redirect('/web/admin')
|
||||||
|
|
Loading…
Add table
Reference in a new issue