mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-12-24 04:52:39 +00:00
Update views.py
check valid user when username == 'root'
This commit is contained in:
@@ -159,10 +159,15 @@ def user_add(request):
|
||||
if '' in [username, password, ssh_key_pwd, name, role]:
|
||||
error = u'带*内容不能为空'
|
||||
raise ServerError
|
||||
|
||||
check_user_is_exist = User.objects.filter(username=username)
|
||||
if check_user_is_exist:
|
||||
error = u'用户 %s 已存在' % username
|
||||
raise ServerError
|
||||
|
||||
if username in ['root']:
|
||||
error = u'用户不能为root'
|
||||
raise ServerError
|
||||
|
||||
except ServerError:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user