diff --git a/main.py b/main.py index 035d50f..bfd3776 100644 --- a/main.py +++ b/main.py @@ -73,7 +73,7 @@ def admin(): status = {} status["db"] = db.dbIsOK() return flask.render_template("status.html" ,status=status) - return "未登录" + return flask.redirect(flask.url_for('login?info=nologin')) @app.route('/admin/list') @@ -81,7 +81,7 @@ def adminList(): if "admin" in flask.session : data = db.getAllKey() return flask.render_template("keylist.html",data=data) - return "未登录 " + return flask.redirect(flask.url_for('login?info=nologin')) @app.route('/admin/createkey', methods=['POST','GET']) def createkey(): @@ -94,7 +94,7 @@ def createkey(): resq = db.createKey(flask.request.form["quota"],1,flask.request.form["key"]) return flask.render_template("createKey.html",resq=resq) - return "未登录 " + return flask.redirect(flask.url_for('login?info=nologin')) @app.route('/admin/lookupkey', methods=['POST','GET']) def lookupkey(): @@ -103,7 +103,7 @@ def lookupkey(): return flask.render_template("lookupKey.html",resq="null") resq = db.userSurplus(flask.request.form["key"]) return flask.render_template("lookupKey.html",resq=resq) - return "未登录 " + return flask.redirect(flask.url_for('login?info=nologin')) @app.route('/admin/operate', methods=['POST','GET']) def operate(): diff --git a/templates/login.html b/templates/login.html index 4f90bc7..8ba8f10 100644 --- a/templates/login.html +++ b/templates/login.html @@ -57,7 +57,10 @@