提交 05a5e9cc 编写于 作者: baltery's avatar baltery

Finish some bug

上级 34a0a37b
......@@ -73,8 +73,15 @@ class SystemUserAuthApi(APIView):
system_user = get_object_or_none(SystemUser, id=system_user_id, username=system_user_username)
if system_user:
password = signer.sign(system_user.password)
private_key = signer.sign(system_user.private_key)
if system_user.password:
password = signer.sign(system_user.password)
else:
password = signer.sign('')
if system_user.private_key:
private_key = signer.sign(system_user.private_key)
else:
private_key = signer.sign(None)
response = {
'id': system_user.id,
......
......@@ -242,7 +242,7 @@ class SystemUserForm(forms.ModelForm):
# Todo: Validate private key file, and generate public key
# Todo: Auto generate private key and public key
if private_key_file:
system_user.private_key = private_key_file.read()
system_user.private_key = private_key_file.read().strip()
system_user.save()
return self.instance
......
......@@ -20,7 +20,6 @@
<div class="hr-line-dashed"></div>
<h3>{% trans 'Asset user' %}</h3>
{{ form.admin_user|bootstrap_horizontal }}
{{ form.system_users|bootstrap_horizontal }}
<div class="hr-line-dashed"></div>
<h3>{% trans 'Other' %}</h3>
......
......@@ -25,7 +25,6 @@
<div class="hr-line-dashed"></div>
<h3>{% trans 'Asset user' %}</h3>
{{ form.admin_user|bootstrap_horizontal }}
{{ form.system_users|bootstrap_horizontal }}
<div class="hr-line-dashed"></div>
<h3>{% trans 'Hardware' %}</h3>
......
......@@ -46,8 +46,6 @@ class AssetListView(AdminUserRequiredMixin, ListView):
return super(AssetListView, self).get_context_data(**kwargs)
class AssetCreateView(AdminUserRequiredMixin,CreateAssetTagsMiXin,CreateView):
model = Asset
tag_type = 'asset'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册