mirror of https://github.com/jumpserver/jumpserver
commit
4f79e909e5
|
@ -87,12 +87,12 @@ def db_update_user(**kwargs):
|
||||||
admin_groups_post = kwargs.pop('admin_groups')
|
admin_groups_post = kwargs.pop('admin_groups')
|
||||||
user_id = kwargs.pop('user_id')
|
user_id = kwargs.pop('user_id')
|
||||||
user = User.objects.filter(id=user_id)
|
user = User.objects.filter(id=user_id)
|
||||||
user_get = User.objects.get(id=user_id)
|
|
||||||
if user:
|
if user:
|
||||||
pwd = kwargs.pop('password')
|
user_get = user[0]
|
||||||
|
password = kwargs.pop('password')
|
||||||
user.update(**kwargs)
|
user.update(**kwargs)
|
||||||
if pwd != '':
|
if password.strip():
|
||||||
user_get.set_password(pwd)
|
user_get.set_password(password)
|
||||||
user_get.save()
|
user_get.save()
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -368,11 +368,6 @@ def user_edit(request):
|
||||||
else:
|
else:
|
||||||
return HttpResponseRedirect(reverse('user_list'))
|
return HttpResponseRedirect(reverse('user_list'))
|
||||||
|
|
||||||
if password != '':
|
|
||||||
password_decode = password
|
|
||||||
else:
|
|
||||||
password_decode = None
|
|
||||||
|
|
||||||
db_update_user(user_id=user_id,
|
db_update_user(user_id=user_id,
|
||||||
password=password,
|
password=password,
|
||||||
name=name,
|
name=name,
|
||||||
|
@ -391,7 +386,7 @@ def user_edit(request):
|
||||||
密码:%s (如果密码为None代表密码为原密码)
|
密码:%s (如果密码为None代表密码为原密码)
|
||||||
权限::%s
|
权限::%s
|
||||||
|
|
||||||
""" % (user.name, URL, user.username, password_decode, user_role.get(role_post, u''))
|
""" % (user.name, URL, user.username, password, user_role.get(role_post, u''))
|
||||||
send_mail('您的信息已修改', msg, MAIL_FROM, [email], fail_silently=False)
|
send_mail('您的信息已修改', msg, MAIL_FROM, [email], fail_silently=False)
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse('user_list'))
|
return HttpResponseRedirect(reverse('user_list'))
|
||||||
|
|
Loading…
Reference in New Issue