功能变化: 更新后端系统配置获取方法及前端插件校验方法
parent
b80573caad
commit
e6a41022ba
|
@ -15,6 +15,8 @@ from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
|
||||||
from rest_framework_simplejwt.views import TokenObtainPairView
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
from application import dispatch
|
||||||
from dvadmin.system.models import Users
|
from dvadmin.system.models import Users
|
||||||
from dvadmin.utils.json_response import ErrorResponse, DetailResponse
|
from dvadmin.utils.json_response import ErrorResponse, DetailResponse
|
||||||
from dvadmin.utils.request_util import save_login_log
|
from dvadmin.utils.request_util import save_login_log
|
||||||
|
@ -34,7 +36,7 @@ class CaptchaView(APIView):
|
||||||
)
|
)
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
data = {}
|
data = {}
|
||||||
if settings.SYSTEM_CONFIG.get("base.captcha_state"):
|
if dispatch.get_system_config_values("base.captcha_state"):
|
||||||
hashkey = CaptchaStore.generate_key()
|
hashkey = CaptchaStore.generate_key()
|
||||||
id = CaptchaStore.objects.filter(hashkey=hashkey).first().id
|
id = CaptchaStore.objects.filter(hashkey=hashkey).first().id
|
||||||
imgage = captcha_image(request, hashkey)
|
imgage = captcha_image(request, hashkey)
|
||||||
|
@ -66,7 +68,7 @@ class LoginSerializer(TokenObtainPairSerializer):
|
||||||
|
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
captcha = self.initial_data.get("captcha", None)
|
captcha = self.initial_data.get("captcha", None)
|
||||||
if settings.SYSTEM_CONFIG.get("base.captcha_state"):
|
if dispatch.get_system_config_values("base.captcha_state"):
|
||||||
if captcha is None:
|
if captcha is None:
|
||||||
raise CustomValidationError("验证码不能为空")
|
raise CustomValidationError("验证码不能为空")
|
||||||
self.image_code = CaptchaStore.objects.filter(
|
self.image_code = CaptchaStore.objects.filter(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from application import settings
|
from application import settings, dispatch
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
|
@ -252,7 +252,7 @@ class UserViewSet(CustomModelViewSet):
|
||||||
"""恢复默认密码"""
|
"""恢复默认密码"""
|
||||||
instance = Users.objects.filter(id=kwargs.get("pk")).first()
|
instance = Users.objects.filter(id=kwargs.get("pk")).first()
|
||||||
if instance:
|
if instance:
|
||||||
instance.set_password(settings.SYSTEM_CONFIG.get("base.default_password"))
|
instance.set_password(dispatch.get_system_config_values("base.default_password"))
|
||||||
instance.save()
|
instance.save()
|
||||||
return DetailResponse(data=None, msg="密码重置成功")
|
return DetailResponse(data=None, msg="密码重置成功")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -18,6 +18,7 @@ import XEUtils from 'xe-utils'
|
||||||
import store from '@/store/index'
|
import store from '@/store/index'
|
||||||
import { urlPrefix as deptPrefix } from '@/views/system/dept/api'
|
import { urlPrefix as deptPrefix } from '@/views/system/dept/api'
|
||||||
import types from '@/config/d2p-extends/types'
|
import types from '@/config/d2p-extends/types'
|
||||||
|
import { checkPlugins } from '@/views/plugins'
|
||||||
const uploadUrl = util.baseURL() + 'api/system/file/'
|
const uploadUrl = util.baseURL() + 'api/system/file/'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +35,11 @@ Vue.use(d2CrudX, { name: 'd2-crud-x' })
|
||||||
|
|
||||||
// // 官方版【此处为演示与官方版共存而引入,全新项目中可以用d2-crud-x完全替代官方版】
|
// // 官方版【此处为演示与官方版共存而引入,全新项目中可以用d2-crud-x完全替代官方版】
|
||||||
// Vue.use(d2Crud)
|
// Vue.use(d2Crud)
|
||||||
|
/**
|
||||||
|
* @description 校验插件是否安装
|
||||||
|
* @param {String} pluginName 插件名称
|
||||||
|
*/
|
||||||
|
Vue.prototype.checkPlugins = checkPlugins
|
||||||
// 引入d2CrudPlus
|
// 引入d2CrudPlus
|
||||||
Vue.use(d2CrudPlus, {
|
Vue.use(d2CrudPlus, {
|
||||||
starTip: false,
|
starTip: false,
|
||||||
|
|
|
@ -34,7 +34,7 @@ util.open = function (url) {
|
||||||
*/
|
*/
|
||||||
util.baseURL = function () {
|
util.baseURL = function () {
|
||||||
var baseURL = process.env.VUE_APP_API
|
var baseURL = process.env.VUE_APP_API
|
||||||
if (window.pluginsAll && window.pluginsAll.indexOf('dvadmin-tenant') !== -1) {
|
if (window.pluginsAll && window.pluginsAll.indexOf('dvadmin-tenant-web') !== -1) {
|
||||||
// document.domain
|
// document.domain
|
||||||
var host = baseURL.split('/')[2]
|
var host = baseURL.split('/')[2]
|
||||||
var prot = host.split(':')[1] || 80
|
var prot = host.split(':')[1] || 80
|
||||||
|
|
Loading…
Reference in New Issue