Skip to content

Commit

Permalink
F 更新LDAP
Browse files Browse the repository at this point in the history
  • Loading branch information
zyupo committed Mar 9, 2020
1 parent 48a090c commit 7208ba8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spug_api/apps/account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion spug_api/apps/account/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spug_web/src/pages/system/account/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ComTable extends React.Component {
<Divider type="vertical"/>
<LinkButton className="span-button" onClick={() => store.showForm(info)}>编辑</LinkButton>
<Divider type="vertical"/>
<LinkButton className="span-button" onClick={() => this.handleReset(info)}>重置密码</LinkButton>
<LinkButton disabled={info['type'] === 'ldap'} className="span-button" onClick={() => this.handleReset(info)}>重置密码</LinkButton>
<Divider type="vertical"/>
<LinkButton className="span-button" onClick={() => this.handleDelete(info)}>删除</LinkButton>
</span>
Expand Down

0 comments on commit 7208ba8

Please sign in to comment.