Finish some bug

pull/530/head
ibuler 2016-11-02 19:44:11 +08:00
parent 34a0a37b63
commit 05a5e9cc69
5 changed files with 10 additions and 7 deletions

View File

@ -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,

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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'