Update routes

This commit is contained in:
Minecon724 2025-04-03 17:00:45 +02:00
commit 9cf2da1128
Signed by: Minecon724
GPG key ID: A02E6E67AB961189

View file

@ -17,10 +17,19 @@ def admin_required(f):
return decorated_function
@app.route('/admin', methods=['GET'])
def admin_login():
return render_template('admin_login.html')
def admin():
if is_admin():
return redirect(url_for('admin_dashboard'))
return redirect(url_for('admin_login'))
@app.route('/admin', methods=['POST'])
@app.route('/admin/login', methods=['GET'])
def admin_login_get():
next_page = request.args.get('next') or url_for('admin_dashboard')
if is_admin():
return redirect(next_page)
return render_template('admin_login.html', next=next_page)
@app.route('/admin/login', methods=['POST'])
@limiter.limit("1 per minute", deduct_when=lambda response: not is_admin())
@limiter.limit("10 per hour")
def admin_login_post():