perf: 修改命令command input 长度问题 (#7996)

* perf: 修改命令command input max_length 1024

* perf: 修改命令command input 长度问题

* perf: 修改命令command input 长度问题

* perf: 修改命令command input 长度问题

* perf: 修改命令command input 长度问题

Co-authored-by: Jiangjie.Bai <bugatti_it@163.com>
This commit is contained in:
fit2bot
2022-03-30 19:07:49 +08:00
committed by GitHub
parent 54d1996507
commit e7af037513
13 changed files with 117 additions and 53 deletions

View File

@@ -11,7 +11,7 @@ from django.conf import settings
from django.core.cache import cache
from common.tasks import send_mail_async
from common.utils import reverse, get_object_or_none, ip
from common.utils import reverse, get_object_or_none, ip, pretty_string
from .models import User
logger = logging.getLogger('jumpserver')
@@ -229,12 +229,14 @@ class LoginIpBlockUtil(BlockGlobalIpUtilBase):
BLOCK_KEY_TMPL = "_LOGIN_BLOCK_{}"
def construct_user_email(username, email):
if '@' not in email:
if '@' in username:
email = username
else:
email = '{}@{}'.format(username, settings.EMAIL_SUFFIX)
def construct_user_email(username, email, email_suffix=''):
if '@' in email:
return email
if '@' in username:
return username
if not email_suffix:
email_suffix = settings.EMAIL_SUFFIX
email = f'{username}@{email_suffix}'
return email