mirror of https://github.com/jumpserver/jumpserver
bugfix
parent
d6b6e745b2
commit
d9d3f25dfd
|
@ -393,9 +393,7 @@ def addUser(request):
|
|||
|
||||
if request.method == 'POST':
|
||||
form = UserAddForm(request.POST)
|
||||
if not form.is_valid():
|
||||
return HttpResponse('error')
|
||||
else:
|
||||
if form.is_valid():
|
||||
user = form.cleaned_data
|
||||
username = user['username']
|
||||
password = user['password']
|
||||
|
@ -808,13 +806,12 @@ def addAssets(request):
|
|||
idc = request.POST.get('idc')
|
||||
comment = request.POST.get('comment')
|
||||
|
||||
idc = IDC.objects.get(id=idc)
|
||||
|
||||
if '' in (ip, port):
|
||||
if '' in (ip, port, idc):
|
||||
error = '带*号内容不能为空。'
|
||||
elif Assets.objects.filter(ip=ip):
|
||||
error = '主机已存在。'
|
||||
if not error:
|
||||
idc = IDC.objects.get(id=idc)
|
||||
asset = Assets(ip=ip, port=port, idc=idc, comment=comment)
|
||||
asset.save()
|
||||
msg = u'%s 添加成功' % ip
|
||||
|
|
|
@ -35,14 +35,14 @@ class UserAddForm(forms.Form):
|
|||
password_again = self.cleaned_data['password_again']
|
||||
|
||||
if password != password_again:
|
||||
raise forms.ValidationError('Password input twice not match. ')
|
||||
raise forms.ValidationError(u'密码二次输入不一致. ')
|
||||
return password_again
|
||||
|
||||
def clean_key_pass_again(self):
|
||||
key_pass = self.data['key_pass']
|
||||
key_pass_again = self.data['key_pass_again']
|
||||
if key_pass != key_pass_again:
|
||||
raise forms.ValidationError('Key Password input twice not match. ')
|
||||
raise forms.ValidationError(u'密码二次输入不一致. ')
|
||||
if len(key_pass) < 6:
|
||||
raise forms.ValidationError('Key Password input twice not match. ')
|
||||
raise forms.ValidationError(u'密码二次输入不一致. ')
|
||||
return key_pass_again
|
Loading…
Reference in New Issue