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)}>删除