From 89e2133341e49c8f2f47dfba25504dccfa143c57 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 30 Dec 2014 22:52:39 +0800 Subject: [PATCH] serve active and user active --- connect.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/connect.py b/connect.py index d20026757..c5741716a 100755 --- a/connect.py +++ b/connect.py @@ -210,11 +210,17 @@ def get_connect_item(username, ip): except ObjectDoesNotExist: raise ServerError("Host %s does not exist." % ip) + if not asset.is_active: + raise ServerError('Host %s is not active.' % ip) + try: user = User.objects.get(username=username) except ObjectDoesNotExist: raise ServerError('User %s does not exist.' % username) + if not user.is_active: + raise ServerError('User %s is not active.' % username) + if asset.login_type == 'L': try: ldap_pwd = cryptor.decrypt(user.ldap_pwd)