Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/web/admin/user_login_check.py

33 lines
1.0 KiB

7 months ago
# coding:utf-8
# ---------------------------------------------------------------------------------
# MW-Linux面板
# ---------------------------------------------------------------------------------
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
# ---------------------------------------------------------------------------------
# Author: midoks <midoks@163.com>
# ---------------------------------------------------------------------------------
6 months ago
from flask import render_template
from flask import Response
7 months ago
from functools import wraps
6 months ago
from admin import session
from admin.common import isLogined
6 months ago
import thisdb
6 months ago
7 months ago
def panel_login_required(func):
6 months ago
@wraps(func)
7 months ago
def wrapper(*args, **kwargs):
6 months ago
if not isLogined():
6 months ago
unauthorized_status = thisdb.getOption('unauthorized_status')
6 months ago
if unauthorized_status == '0':
return render_template('default/path.html')
return Response(status=int(unauthorized_status))
6 months ago
7 months ago
return func(*args, **kwargs)
return wrapper