mirror of
https://github.com/Kakune55/PyGetGPT.git
synced 2025-05-06 18:29:24 +08:00
完善未登录跳转功能
This commit is contained in:
parent
afdbdec803
commit
dc374e5259
8
main.py
8
main.py
@ -73,7 +73,7 @@ def admin():
|
|||||||
status = {}
|
status = {}
|
||||||
status["db"] = db.dbIsOK()
|
status["db"] = db.dbIsOK()
|
||||||
return flask.render_template("status.html" ,status=status)
|
return flask.render_template("status.html" ,status=status)
|
||||||
return "未登录"
|
return flask.redirect(flask.url_for('login?info=nologin'))
|
||||||
|
|
||||||
|
|
||||||
@app.route('/admin/list')
|
@app.route('/admin/list')
|
||||||
@ -81,7 +81,7 @@ def adminList():
|
|||||||
if "admin" in flask.session :
|
if "admin" in flask.session :
|
||||||
data = db.getAllKey()
|
data = db.getAllKey()
|
||||||
return flask.render_template("keylist.html",data=data)
|
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'])
|
@app.route('/admin/createkey', methods=['POST','GET'])
|
||||||
def createkey():
|
def createkey():
|
||||||
@ -94,7 +94,7 @@ def createkey():
|
|||||||
resq = db.createKey(flask.request.form["quota"],1,flask.request.form["key"])
|
resq = db.createKey(flask.request.form["quota"],1,flask.request.form["key"])
|
||||||
|
|
||||||
return flask.render_template("createKey.html",resq=resq)
|
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'])
|
@app.route('/admin/lookupkey', methods=['POST','GET'])
|
||||||
def lookupkey():
|
def lookupkey():
|
||||||
@ -103,7 +103,7 @@ def lookupkey():
|
|||||||
return flask.render_template("lookupKey.html",resq="null")
|
return flask.render_template("lookupKey.html",resq="null")
|
||||||
resq = db.userSurplus(flask.request.form["key"])
|
resq = db.userSurplus(flask.request.form["key"])
|
||||||
return flask.render_template("lookupKey.html",resq=resq)
|
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'])
|
@app.route('/admin/operate', methods=['POST','GET'])
|
||||||
def operate():
|
def operate():
|
||||||
|
@ -57,7 +57,10 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
const info = '<%=request.getParameter("info")%>';
|
||||||
|
if (info === 'nologin') {
|
||||||
|
alert("未登录或登录已过期!\n请重新登录");
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user