mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-06-16 19:35:24 +02:00
Implemented Bot Admin Blueprint
Todo and not yet fully functional yet Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing Fix Titan Dev thing
This commit is contained in:
1
webapp/titanembeds/blueprints/admin/__init__.py
Normal file
1
webapp/titanembeds/blueprints/admin/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from admin import admin
|
22
webapp/titanembeds/blueprints/admin/admin.py
Normal file
22
webapp/titanembeds/blueprints/admin/admin.py
Normal file
@ -0,0 +1,22 @@
|
||||
from flask import Blueprint, url_for, redirect, session, render_template
|
||||
from functools import wraps
|
||||
from titanembeds import devs
|
||||
|
||||
admin = Blueprint("admin", __name__)
|
||||
|
||||
def is_admin(f):
|
||||
def decorator(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
if 'user_id' not in session:
|
||||
return redirect(url_for("index"))
|
||||
if session['user_id'] not in devs:
|
||||
return redirect(url_for("index"))
|
||||
return f(*args, **kwargs)
|
||||
return decorated_function
|
||||
return decorator(f)
|
||||
|
||||
@admin.route("/")
|
||||
@is_admin
|
||||
def index():
|
||||
return render_template("admin_index.html.j2")
|
Reference in New Issue
Block a user