From 7208ba803eb68868ea6efed945d7cd5293e1b628 Mon Sep 17 00:00:00 2001 From: zypo Date: Mon, 9 Mar 2020 14:01:07 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E6=9B=B4=E6=96=B0LDAP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/models.py | 2 +- spug_api/apps/account/views.py | 2 +- spug_web/src/pages/system/account/Table.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spug_api/apps/account/models.py b/spug_api/apps/account/models.py index 281e344a..3c78009e 100644 --- a/spug_api/apps/account/models.py +++ b/spug_api/apps/account/models.py @@ -34,7 +34,7 @@ def verify_password(self, plain_password: str) -> bool: @property def page_perms(self): - if self.role.page_perms: + if self.role and self.role.page_perms: data = [] perms = json.loads(self.role.page_perms) for m, v in perms.items(): diff --git a/spug_api/apps/account/views.py b/spug_api/apps/account/views.py index 41a8bbb7..24f057d3 100644 --- a/spug_api/apps/account/views.py +++ b/spug_api/apps/account/views.py @@ -148,7 +148,7 @@ def login(request): is_success, message = ldap.valid_user(form.username, form.password) if is_success: if not user: - user = User.objects.create(username=form.username, nickname=form.username) + user = User.objects.create(username=form.username, nickname=form.username, type=form.type) return handle_user_info(user, x_real_ip) elif message: return json_response(error=message) diff --git a/spug_web/src/pages/system/account/Table.js b/spug_web/src/pages/system/account/Table.js index 2b5b24f0..1cccd2db 100644 --- a/spug_web/src/pages/system/account/Table.js +++ b/spug_web/src/pages/system/account/Table.js @@ -55,7 +55,7 @@ class ComTable extends React.Component { store.showForm(info)}>编辑 - this.handleReset(info)}>重置密码 + this.handleReset(info)}>重置密码 this.handleDelete(info)}>删除