Update routes
This commit is contained in:
parent
bf4bc3cf0c
commit
9cf2da1128
1 changed files with 12 additions and 3 deletions
|
|
@ -17,10 +17,19 @@ def admin_required(f):
|
||||||
return decorated_function
|
return decorated_function
|
||||||
|
|
||||||
@app.route('/admin', methods=['GET'])
|
@app.route('/admin', methods=['GET'])
|
||||||
def admin_login():
|
def admin():
|
||||||
return render_template('admin_login.html')
|
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("1 per minute", deduct_when=lambda response: not is_admin())
|
||||||
@limiter.limit("10 per hour")
|
@limiter.limit("10 per hour")
|
||||||
def admin_login_post():
|
def admin_login_post():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue