Skip to content

Commit

Permalink
调整日志等级
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo committed Mar 23, 2019
1 parent e3c8f71 commit e840633
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions common/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def init_user(user):
group = Group.objects.get(name=default_auth_group)
user.groups.add(group)
except Exception:
logger.error(traceback.format_exc())
logger.error('无name为{}的权限组,无法默认关联,请到系统设置进行配置'.format(default_auth_group))
logger.info('无name为{}的权限组,无法默认关联,请到系统设置进行配置'.format(default_auth_group))
# 添加到默认资源组
default_resource_group = SysConfig().get('default_resource_group', '')
if default_resource_group:
Expand All @@ -37,11 +36,10 @@ def init_user(user):
group_name=default_resource_group)
new_relation.save()
except Exception:
logger.error(traceback.format_exc())
logger.error('无name为{}的资源组,无法默认关联,请到系统设置进行配置'.format(default_resource_group))
logger.info('无name为{}的资源组,无法默认关联,请到系统设置进行配置'.format(default_resource_group))


class ArcherAuth(object):
class ArcheryAuth(object):
def __init__(self, request):
self.request = request

Expand All @@ -59,7 +57,6 @@ def authenticate(self):
username = self.request.POST.get('username')
password = self.request.POST.get('password')
# 验证时候在加锁时间内
now = datetime.datetime.now()
try:
user = Users.objects.get(username=username)
except Users.DoesNotExist:
Expand Down Expand Up @@ -112,7 +109,7 @@ def authenticate(self):
# ajax接口,登录页面调用,用来验证用户名密码
def authenticate_entry(request):
"""接收http请求,然后把请求中的用户名密码传给ArcherAuth去验证"""
new_auth = ArcherAuth(request)
new_auth = ArcheryAuth(request)
result = new_auth.authenticate()
if result['status'] == 0:
result = {'status': 0, 'msg': 'ok', 'data': None}
Expand Down

0 comments on commit e840633

Please sign in to comment.