forked from mirror/MrDoc
修改管理员无法为文集设置协作用户的问题;调整用户名限制
This commit is contained in:
parent
e9c8e1fe3c
commit
6119a7359d
@ -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':'电子邮箱不可重复'})
|
||||
|
@ -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)) # 获取用户列表
|
||||
|
Loading…
x
Reference in New Issue
Block a user