update
This commit is contained in:
@@ -142,3 +142,8 @@ STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
|
|||||||
|
|
||||||
# AUTH_USER_MODEL为我们自定义的用户类
|
# AUTH_USER_MODEL为我们自定义的用户类
|
||||||
AUTH_USER_MODEL = "server_auth.MindUser"
|
AUTH_USER_MODEL = "server_auth.MindUser"
|
||||||
|
|
||||||
|
# 自定义 登陆手段
|
||||||
|
AUTHENTICATION_BACKENDS = [
|
||||||
|
'server_auth.lib.auth.AuthBackend',
|
||||||
|
]
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ from server.filters import CooperationMindFilter
|
|||||||
from server.serializers import *
|
from server.serializers import *
|
||||||
from server.util.mix_util import build_response
|
from server.util.mix_util import build_response
|
||||||
from server.util.pagination import NewPagination
|
from server.util.pagination import NewPagination
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
|
|
||||||
def to_dashboard(request):
|
def to_dashboard(request):
|
||||||
"""
|
"""
|
||||||
界面
|
界面
|
||||||
"""
|
"""
|
||||||
|
print(request.user)
|
||||||
return render(request, "html/dashboard.html")
|
return render(request, "html/dashboard.html")
|
||||||
|
|
||||||
|
|
||||||
@@ -50,6 +52,7 @@ class JsMindView(ListAPIView):
|
|||||||
filter_class = CooperationMindFilter
|
filter_class = CooperationMindFilter
|
||||||
pagination_class = NewPagination
|
pagination_class = NewPagination
|
||||||
|
|
||||||
|
@login_required(login_url="dashboard")
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
查询思维导图
|
查询思维导图
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
from django.contrib.auth.backends import ModelBackend # 验证基类
|
||||||
|
from server_auth.models import MindUser
|
||||||
|
|
||||||
|
from django.contrib.auth import authenticate, login, logout
|
||||||
|
|
||||||
|
class AuthBackend(ModelBackend):
|
||||||
|
"""
|
||||||
|
login 方法会调用该方法
|
||||||
|
"""
|
||||||
|
|
||||||
|
# 重写验证方式
|
||||||
|
def authenticate(self, request, username=None, password=None, **kwargs):
|
||||||
|
user = MindUser.objects.get(id=1)
|
||||||
|
if user is not None and user.check_password(password):
|
||||||
|
return user
|
||||||
|
|
||||||
|
|
||||||
# 登录方式有多种
|
# 登录方式有多种
|
||||||
# 1、用户名密码登录:直接匹配数据库的用户名密码
|
# 1、用户名密码登录:直接匹配数据库的用户名密码
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,16 @@
|
|||||||
<!--script start-->
|
<!--script start-->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
||||||
<script src="/static/bootstrap-4.6.1-dist/js/bootstrap.bundle.js"></script> <!-- bootstrap.bundle.min.js,还包含了 Popper,用于支持工具提示(tooltip)和弹出框(popover)功能,但是不包含 jQuery。-->
|
<script src="/static/bootstrap-4.6.1-dist/js/bootstrap.bundle.js"></script> <!-- bootstrap.bundle.min.js,还包含了 Popper,用于支持工具提示(tooltip)和弹出框(popover)功能,但是不包含 jQuery。-->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js"></script> <!-- 图标相关-->
|
||||||
<script>
|
<script>
|
||||||
|
const qr_websocket = {
|
||||||
|
websocket: null,
|
||||||
|
uuid: (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$('#exampleModal').on('show.bs.modal', function (event) {
|
$('#exampleModal').on('show.bs.modal', function (event) {
|
||||||
|
console.log(qr_websocket)
|
||||||
console.log('打开');
|
console.log('打开');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Jsmind</title>
|
<title>Jsmind</title>
|
||||||
<link rel="shortcut icon" href="/static/abl1b-qks1b-001.ico"/>
|
<link rel="shortcut icon" href="/static/abl1b-qks1b-001.ico"/>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/style/jsmind.css">
|
<link rel="stylesheet" type="text/css" href="/static/js/jsmind.css">
|
||||||
<style>
|
<style>
|
||||||
#jsmind_container {
|
#jsmind_container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
||||||
<title>modal</title>
|
|
||||||
|
|
||||||
<link rel="shortcut icon" href="/static/abl1b-qks1b-001.ico"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/bootstrap-4.6.1-dist/css/bootstrap.css">
|
|
||||||
|
|
||||||
<!--script start-->
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
|
|
||||||
<!--script end-->
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
test
|
|
||||||
|
|
||||||
<script src="/static/bootstrap-4.6.1-dist/js/bootstrap.bundle.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user