rbac基本完成

This commit is contained in:
mkg
2021-03-22 20:42:02 +08:00
parent 328458eda9
commit 4c8917fe05
17 changed files with 777 additions and 268 deletions
+4 -9
View File
@@ -1,23 +1,18 @@
from flask import Blueprint, render_template, jsonify, request, session, redirect, url_for
from flask_login import login_user, login_required, logout_user, current_user
from applications.models.admin import User
from applications.service.admin.index import add_auth_session, make_menu_tree, get_captcha
from flask_marshmallow import Marshmallow
from applications.service.route_auth import PreAuthorize
from applications.service.admin_log import login_log
from applications.models.admin import User
admin_index = Blueprint('adminIndex', __name__, url_prefix='/admin')
ma = Marshmallow()
# 首页
@admin_index.route('/')
@login_required
def index():
username = current_user.username
return render_template('admin/index.html', username=username)
realname = current_user.realname
return render_template('admin/index.html', realname=realname)
# 获取验证码
@@ -51,7 +46,7 @@ def login():
if user is None:
return jsonify(msg="不存在的用户", code=0,success=False)
if user.enable is 0:
if user.enable is 1:
return jsonify(msg="用户被暂停使用", code=0,success=False)
if username == user.username and user.validate_password(password):