perf: Lina translate (#13548)

Co-authored-by: feng <1304903146@qq.com>
pull/13550/head
fit2bot 2024-07-01 10:15:06 +08:00 committed by GitHub
parent e712e8ccfc
commit aeb320ba30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 2 deletions

View File

@ -391,6 +391,7 @@
"DeleteSuccess": "Successfully deleted",
"DeleteSuccessMsg": "Successfully deleted",
"DeleteWarningMsg": "Are you sure you want to delete",
"RemoveWarningMsg": "Are you sure you want to remove",
"Deploy": "Deployment",
"Description": "Description",
"DestinationIP": "Destination address",

View File

@ -391,6 +391,7 @@
"DeleteSuccess": "删除成功",
"DeleteSuccessMsg": "删除成功",
"DeleteWarningMsg": "你确定要删除",
"RemoveWarningMsg": "你确定要移除",
"Deploy": "部署",
"Description": "描述",
"DestinationIP": "目的地址",

View File

@ -16,6 +16,7 @@ from common.serializers.fields import (
)
from common.utils import pretty_string, get_logger
from common.validators import PhoneValidator
from jumpserver.utils import get_current_request
from orgs.utils import current_org
from rbac.builtin import BuiltinRole
from rbac.models import OrgRoleBinding, SystemRoleBinding, Role
@ -353,7 +354,10 @@ class UserSerializer(
attrs = self.check_disallow_self_update_fields(attrs)
attrs = self.change_password_to_raw(attrs)
attrs = self.clean_auth_fields(attrs)
attrs.pop("password_strategy", None)
password_strategy = attrs.pop("password_strategy", None)
request = get_current_request()
if request:
request.password_strategy = password_strategy
return attrs
def save_and_set_custom_m2m_fields(self, validated_data, save_handler, created):

View File

@ -110,7 +110,9 @@ def on_user_create(sender, user=None, **kwargs):
logger.debug("Receive user `{}` create signal".format(user.name))
from .utils import send_user_created_mail
logger.info(" - Sending welcome mail ...".format(user.name))
if user.can_send_created_mail():
request = get_current_request()
password_strategy = getattr(request, 'password_strategy', '')
if user.can_send_created_mail() and password_strategy == 'email':
send_user_created_mail(user)