From 6119a7359d3d14189c5ad6a0844e22ad4fc12c1d Mon Sep 17 00:00:00 2001 From: yangjian Date: Sun, 10 Jan 2021 08:53:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=B8=BA=E6=96=87=E9=9B=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=8D=8F=E4=BD=9C=E7=94=A8=E6=88=B7=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B=E8=B0=83=E6=95=B4=E7=94=A8=E6=88=B7=E5=90=8D=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_admin/views.py | 6 +++--- app_doc/views.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app_admin/views.py b/app_admin/views.py index c9c7e61..9dfd0df 100644 --- a/app_admin/views.py +++ b/app_admin/views.py @@ -105,8 +105,8 @@ def register(request): elif re.match('^[0-9a-z]+$',username) is False: errormsg = '用户名只能为英文数字组合' return render(request, 'register.html', locals()) - elif len(username) < 6: - errormsg = '用户名必须大于等于6位!' + elif len(username) < 5: + errormsg = '用户名必须大于等于5位!' return render(request, 'register.html', locals()) elif len(password) < 6: # 验证密码长度 errormsg = '密码必须大于等于6位!' @@ -284,7 +284,7 @@ def admin_create_user(request): password = request.POST.get('password','') # 接收密码参数 user_type = request.POST.get('user_type',0) # 用户类型 0为普通用户,1位管理员 if username != '' and password != '' and email != '' and \ - '@' in email and re.match(r'^[0-9a-z]',username) and len(username) >= 6 : + '@' in email and re.match(r'^[0-9a-z]',username) and len(username) >= 5 : # 不允许电子邮箱重复 if User.objects.filter(email = email).count() > 0: return JsonResponse({'status':False,'data':'电子邮箱不可重复'}) diff --git a/app_doc/views.py b/app_doc/views.py index b2a6195..850738a 100644 --- a/app_doc/views.py +++ b/app_doc/views.py @@ -731,9 +731,12 @@ def modify_project_download(request,pro_id): @require_http_methods(['GET',"POST"]) @logger.catch() def manage_project_collaborator(request,pro_id): - project = Project.objects.filter(id=pro_id, create_user=request.user) + if request.user.is_superuser: + project = Project.objects.filter(id=pro_id) + else: + project = Project.objects.filter(id=pro_id, create_user=request.user) if project.exists() is False: - return Http404 + return render(request, '404.html') if request.method == 'GET': user_list = User.objects.filter(~Q(username=request.user.username)) # 获取用户列表