mirror of https://github.com/jumpserver/jumpserver
parent
e712e8ccfc
commit
aeb320ba30
|
@ -391,6 +391,7 @@
|
||||||
"DeleteSuccess": "Successfully deleted",
|
"DeleteSuccess": "Successfully deleted",
|
||||||
"DeleteSuccessMsg": "Successfully deleted",
|
"DeleteSuccessMsg": "Successfully deleted",
|
||||||
"DeleteWarningMsg": "Are you sure you want to delete",
|
"DeleteWarningMsg": "Are you sure you want to delete",
|
||||||
|
"RemoveWarningMsg": "Are you sure you want to remove",
|
||||||
"Deploy": "Deployment",
|
"Deploy": "Deployment",
|
||||||
"Description": "Description",
|
"Description": "Description",
|
||||||
"DestinationIP": "Destination address",
|
"DestinationIP": "Destination address",
|
||||||
|
|
|
@ -391,6 +391,7 @@
|
||||||
"DeleteSuccess": "删除成功",
|
"DeleteSuccess": "删除成功",
|
||||||
"DeleteSuccessMsg": "删除成功",
|
"DeleteSuccessMsg": "删除成功",
|
||||||
"DeleteWarningMsg": "你确定要删除",
|
"DeleteWarningMsg": "你确定要删除",
|
||||||
|
"RemoveWarningMsg": "你确定要移除",
|
||||||
"Deploy": "部署",
|
"Deploy": "部署",
|
||||||
"Description": "描述",
|
"Description": "描述",
|
||||||
"DestinationIP": "目的地址",
|
"DestinationIP": "目的地址",
|
||||||
|
|
|
@ -16,6 +16,7 @@ from common.serializers.fields import (
|
||||||
)
|
)
|
||||||
from common.utils import pretty_string, get_logger
|
from common.utils import pretty_string, get_logger
|
||||||
from common.validators import PhoneValidator
|
from common.validators import PhoneValidator
|
||||||
|
from jumpserver.utils import get_current_request
|
||||||
from orgs.utils import current_org
|
from orgs.utils import current_org
|
||||||
from rbac.builtin import BuiltinRole
|
from rbac.builtin import BuiltinRole
|
||||||
from rbac.models import OrgRoleBinding, SystemRoleBinding, Role
|
from rbac.models import OrgRoleBinding, SystemRoleBinding, Role
|
||||||
|
@ -353,7 +354,10 @@ class UserSerializer(
|
||||||
attrs = self.check_disallow_self_update_fields(attrs)
|
attrs = self.check_disallow_self_update_fields(attrs)
|
||||||
attrs = self.change_password_to_raw(attrs)
|
attrs = self.change_password_to_raw(attrs)
|
||||||
attrs = self.clean_auth_fields(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
|
return attrs
|
||||||
|
|
||||||
def save_and_set_custom_m2m_fields(self, validated_data, save_handler, created):
|
def save_and_set_custom_m2m_fields(self, validated_data, save_handler, created):
|
||||||
|
|
|
@ -110,7 +110,9 @@ def on_user_create(sender, user=None, **kwargs):
|
||||||
logger.debug("Receive user `{}` create signal".format(user.name))
|
logger.debug("Receive user `{}` create signal".format(user.name))
|
||||||
from .utils import send_user_created_mail
|
from .utils import send_user_created_mail
|
||||||
logger.info(" - Sending welcome mail ...".format(user.name))
|
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)
|
send_user_created_mail(user)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue