feat: 默认密码从conf中读取
This commit is contained in:
parent
550a3281bc
commit
2843905def
|
@ -42,7 +42,6 @@ from cron_descriptor import get_description
|
|||
import locale
|
||||
from drf_yasg.utils import swagger_auto_schema
|
||||
from server.settings import get_sysconfig, update_sysconfig, update_dict
|
||||
from apps.utils.constants import DEFAULT_PWD
|
||||
from django.core.cache import cache
|
||||
from apps.utils.permission import get_user_route
|
||||
|
||||
|
@ -481,7 +480,7 @@ class UserViewSet(CustomModelViewSet):
|
|||
|
||||
创建用户
|
||||
"""
|
||||
password = make_password(DEFAULT_PWD)
|
||||
password = make_password(get_sysconfig("default_pwd", "abc!0000"))
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
instance = serializer.save(password=password, belong_dept=None)
|
||||
|
@ -530,7 +529,7 @@ class UserViewSet(CustomModelViewSet):
|
|||
def reset_password(self, request, pk=None):
|
||||
user = self.get_object()
|
||||
if request.user.is_superuser:
|
||||
user.set_password(DEFAULT_PWD)
|
||||
user.set_password(get_sysconfig("default_pwd", "abc!0000"))
|
||||
user.save()
|
||||
else:
|
||||
raise PermissionDenied()
|
||||
|
|
Loading…
Reference in New Issue