Skip to content

Commit

Permalink
U 更新ldap登录
Browse files Browse the repository at this point in the history
  • Loading branch information
vapao committed Mar 9, 2020
1 parent edad14e commit 48a090c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions spug_api/apps/account/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def login(request):
if not user:
user = User.objects.create(username=form.username, nickname=form.username)
return handle_user_info(user, x_real_ip)
elif message:
return json_response(error=message)
else:
if user and user.deleted_by is None:
if user.verify_password(form.password):
Expand Down
5 changes: 3 additions & 2 deletions spug_api/libs/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def valid_user(self, username, password):
conn.simple_bind_s(result_data[0][0], password)
return True, None
else:
return False, 'LDAP用户未找到'
return False, None
except Exception as error:
return False, '%s' % error
args = error.args
return False, args[0].get('desc', '未知错误') if args else '%s' % error

0 comments on commit 48a090c

Please sign in to comment.