From d366b711da20baec032eade07f475d028827f891 Mon Sep 17 00:00:00 2001 From: BaiJiangJie Date: Sun, 29 Sep 2019 12:14:11 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[Update]=20=E5=88=A0=E9=99=A4=20README=20?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E9=87=8F=E7=BB=9F=E8=AE=A1=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 1f178fa46..37a703847 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Jumpserver 多云环境下更好用的堡垒机 -![Total visitor](https://visitor-count-badge.herokuapp.com/total.svg?repo_id=jumpserver) -![Visitors in today](https://visitor-count-badge.herokuapp.com/today.svg?repo_id=jumpserver) [![Python3](https://img.shields.io/badge/python-3.6-green.svg?style=plastic)](https://www.python.org/) [![Django](https://img.shields.io/badge/django-2.1-brightgreen.svg?style=plastic)](https://www.djangoproject.com/) [![Ansible](https://img.shields.io/badge/ansible-2.4.2.0-blue.svg?style=plastic)](https://www.ansible.com/) From b90960e6e1e87a7c464dda311dfca2ccc47b4eb7 Mon Sep 17 00:00:00 2001 From: BaiJiangJie Date: Fri, 20 Dec 2019 10:24:09 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E7=94=A8=E6=88=B7=E6=9C=89=E6=95=88=E6=80=A7=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/utils.py | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/apps/authentication/utils.py b/apps/authentication/utils.py index eb1649885..197aa113a 100644 --- a/apps/authentication/utils.py +++ b/apps/authentication/utils.py @@ -1,31 +1,20 @@ # -*- coding: utf-8 -*- # -from django.utils.translation import ugettext as _ from django.contrib.auth import authenticate -from common.utils import ( - get_ip_city, get_object_or_none, validate_ip -) -from users.models import User from . import errors def check_user_valid(**kwargs): password = kwargs.pop('password', None) public_key = kwargs.pop('public_key', None) - email = kwargs.pop('email', None) username = kwargs.pop('username', None) request = kwargs.get('request') - if username: - user = get_object_or_none(User, username=username) - elif email: - user = get_object_or_none(User, email=email) - else: - user = None - - if user is None: - return None, errors.reason_user_not_exist + user = authenticate(request, username=username, + password=password, public_key=public_key) + if not user: + return None, errors.reason_password_failed elif user.is_expired: return None, errors.reason_user_inactive elif not user.is_active: @@ -33,9 +22,4 @@ def check_user_valid(**kwargs): elif user.password_has_expired: return None, errors.reason_password_expired - if password or public_key: - user = authenticate(request, username=username, - password=password, public_key=public_key) - if user: - return user, '' - return None, errors.reason_password_failed + return user, '' From 76ac0215fe9c0018567156159d2b6ca030438d7f Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 26 Feb 2020 16:12:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?[update]=20=E4=BF=AE=E5=A4=8D=E8=8E=B7?= =?UTF-8?q?=E5=8F=96settings=E6=9C=89=E9=97=AE=E9=A2=98=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/settings/custom.py | 1 + apps/settings/api.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/jumpserver/settings/custom.py b/apps/jumpserver/settings/custom.py index 0a910f984..ef768a56b 100644 --- a/apps/jumpserver/settings/custom.py +++ b/apps/jumpserver/settings/custom.py @@ -82,3 +82,4 @@ USER_GUIDE_URL = DYNAMIC.USER_GUIDE_URL HTTP_LISTEN_PORT = CONFIG.HTTP_LISTEN_PORT WS_LISTEN_PORT = CONFIG.WS_LISTEN_PORT LOGIN_LOG_KEEP_DAYS = DYNAMIC.LOGIN_LOG_KEEP_DAYS +WINDOWS_SKIP_ALL_MANUAL_PASSWORD = CONFIG.WINDOWS_SKIP_ALL_MANUAL_PASSWORD diff --git a/apps/settings/api.py b/apps/settings/api.py index 354cbdd1d..0346c3135 100644 --- a/apps/settings/api.py +++ b/apps/settings/api.py @@ -250,11 +250,10 @@ class PublicSettingApi(generics.RetrieveAPIView): serializer_class = PublicSettingSerializer def get_object(self): - c = settings.CONFIG instance = { "data": { - "WINDOWS_SKIP_ALL_MANUAL_PASSWORD": c.WINDOWS_SKIP_ALL_MANUAL_PASSWORD, - "SECURITY_MAX_IDLE_TIME": c.SECURITY_MAX_IDLE_TIME, + "WINDOWS_SKIP_ALL_MANUAL_PASSWORD": settings.WINDOWS_SKIP_ALL_MANUAL_PASSWORD, + "SECURITY_MAX_IDLE_TIME": settings.SECURITY_MAX_IDLE_TIME, } } return instance From c354b55f616809ed2bf1387dec53b50c3f1a727a Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 26 Feb 2020 16:12:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?[update]=20=E4=BF=AE=E5=A4=8D=E8=8E=B7?= =?UTF-8?q?=E5=8F=96settings=E6=9C=89=E9=97=AE=E9=A2=98=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/settings/api.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/settings/api.py b/apps/settings/api.py index 0346c3135..025db8ae8 100644 --- a/apps/settings/api.py +++ b/apps/settings/api.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- # -import os import json -import jms_storage from smtplib import SMTPSenderRefused from rest_framework import generics @@ -12,7 +10,6 @@ from django.conf import settings from django.core.mail import send_mail from django.utils.translation import ugettext_lazy as _ -from .models import Setting from .utils import ( LDAPServerUtil, LDAPCacheUtil, LDAPImportUtil, LDAPSyncUtil, LDAP_USE_CACHE_FLAGS