Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
7715e62d
Unverified
Commit
7715e62d
authored
Jun 14, 2019
by
BaiJiangJie
Committed by
GitHub
Jun 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 邮件设置添加配置项:发送账号 (#2796)
parent
5286bf3a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
69 deletions
+110
-69
tasks.py
apps/common/tasks.py
+2
-1
settings.py
apps/jumpserver/settings.py
+1
-0
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+95
-66
api.py
apps/settings/api.py
+3
-1
forms.py
apps/settings/forms.py
+8
-1
serializers.py
apps/settings/serializers.py
+1
-0
No files found.
apps/common/tasks.py
View file @
7715e62d
...
...
@@ -24,7 +24,8 @@ def send_mail_async(*args, **kwargs):
if
len
(
args
)
==
3
:
args
=
list
(
args
)
args
[
0
]
=
settings
.
EMAIL_SUBJECT_PREFIX
+
args
[
0
]
args
.
insert
(
2
,
settings
.
EMAIL_HOST_USER
)
email_from
=
settings
.
EMAIL_FROM
or
settings
.
EMAIL_HOST_USER
args
.
insert
(
2
,
email_from
)
args
=
tuple
(
args
)
try
:
...
...
apps/jumpserver/settings.py
View file @
7715e62d
...
...
@@ -353,6 +353,7 @@ EMAIL_HOST = 'smtp.jumpserver.org'
EMAIL_PORT
=
25
EMAIL_HOST_USER
=
'noreply@jumpserver.org'
EMAIL_HOST_PASSWORD
=
''
EMAIL_FROM
=
''
EMAIL_USE_SSL
=
False
EMAIL_USE_TLS
=
False
EMAIL_SUBJECT_PREFIX
=
'[JMS] '
...
...
apps/locale/zh/LC_MESSAGES/django.mo
View file @
7715e62d
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
7715e62d
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-06-1
3 18:56
+0800\n"
"POT-Creation-Date: 2019-06-1
4 10:41
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
...
...
@@ -183,6 +183,7 @@ msgstr "系统用户"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:12
#: xpack/plugins/orgs/templates/orgs/org_detail.html:52
#: xpack/plugins/orgs/templates/orgs/org_list.html:12
#: xpack/plugins/vault/templates/vault/vault.html:90
msgid "Name"
msgstr "名称"
...
...
@@ -446,6 +447,7 @@ msgstr "详情"
#: xpack/plugins/cloud/templates/cloud/account_list.html:39
#: xpack/plugins/orgs/templates/orgs/org_detail.html:25
#: xpack/plugins/orgs/templates/orgs/org_list.html:87
#: xpack/plugins/vault/templates/vault/vault.html:149
msgid "Update"
msgstr "更新"
...
...
@@ -486,6 +488,7 @@ msgstr "更新"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:55
#: xpack/plugins/orgs/templates/orgs/org_detail.html:29
#: xpack/plugins/orgs/templates/orgs/org_list.html:89
#: xpack/plugins/vault/templates/vault/vault.html:150
msgid "Delete"
msgstr "删除"
...
...
@@ -544,6 +547,7 @@ msgstr "创建远程应用"
#: xpack/plugins/cloud/templates/cloud/account_list.html:16
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:18
#: xpack/plugins/orgs/templates/orgs/org_list.html:23
#: xpack/plugins/vault/templates/vault/vault.html:78
msgid "Action"
msgstr "动作"
...
...
@@ -727,6 +731,7 @@ msgstr "SSH网关,支持代理SSH,RDP和VNC"
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_list.html:53
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_subtask_list.html:12
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:13
#: xpack/plugins/vault/templates/vault/vault.html:74
msgid "Username"
msgstr "用户名"
...
...
@@ -742,7 +747,7 @@ msgstr "密码或密钥密码"
#: authentication/forms.py:13
#: authentication/templates/authentication/login.html:67
#: authentication/templates/authentication/new_login.html:93
#: settings/forms.py:1
03
users/forms.py:15 users/forms.py:27
#: settings/forms.py:1
10
users/forms.py:15 users/forms.py:27
#: users/templates/users/reset_password.html:53
#: users/templates/users/user_password_authentication.html:18
#: users/templates/users/user_password_update.html:43
...
...
@@ -818,10 +823,11 @@ msgstr "端口"
#: assets/templates/assets/user_asset_list.html:45
#: assets/templates/assets/user_asset_list.html:167
#: audits/templates/audits/login_log_list.html:54
#: perms/templates/perms/asset_permission_asset.html:55 settings/forms.py:1
33
#: perms/templates/perms/asset_permission_asset.html:55 settings/forms.py:1
40
#: users/templates/users/user_granted_asset.html:45
#: users/templates/users/user_group_granted_asset.html:45
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_asset_list.html:51
#: xpack/plugins/vault/templates/vault/vault.html:73
msgid "IP"
msgstr "IP"
...
...
@@ -835,10 +841,11 @@ msgstr "IP"
#: assets/templates/assets/user_asset_list.html:44
#: assets/templates/assets/user_asset_list.html:166
#: perms/templates/perms/asset_permission_asset.html:54
#: perms/templates/perms/asset_permission_list.html:77 settings/forms.py:13
2
#: perms/templates/perms/asset_permission_list.html:77 settings/forms.py:13
9
#: users/templates/users/user_granted_asset.html:44
#: users/templates/users/user_group_granted_asset.html:44
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_asset_list.html:50
#: xpack/plugins/vault/templates/vault/vault.html:72
msgid "Hostname"
msgstr "主机名"
...
...
@@ -967,6 +974,7 @@ msgstr "最新版本"
#: assets/models/authbook.py:29 ops/templates/ops/adhoc_history.html:58
#: ops/templates/ops/adhoc_history_detail.html:57
#: ops/templates/ops/task_adhoc.html:58 ops/templates/ops/task_history.html:64
#: xpack/plugins/vault/templates/vault/vault.html:75
msgid "Version"
msgstr "版本"
...
...
@@ -1208,6 +1216,7 @@ msgid "Hardware info"
msgstr "硬件信息"
#: assets/serializers/asset.py:53
#: xpack/plugins/vault/templates/vault/vault.html:76
msgid "Connectivity"
msgstr "连接"
...
...
@@ -1592,6 +1601,7 @@ msgstr "Windows或其它硬件可以随意设置一个"
#: audits/templates/audits/login_log_list.html:85
#: users/templates/users/user_group_list.html:10
#: users/templates/users/user_list.html:10
#: xpack/plugins/vault/templates/vault/vault.html:55
msgid "Export"
msgstr "导出"
...
...
@@ -1602,6 +1612,7 @@ msgstr "导出"
#: users/templates/users/user_group_list.html:15
#: users/templates/users/user_list.html:15
#: xpack/plugins/license/templates/license/license_detail.html:110
#: xpack/plugins/vault/templates/vault/vault.html:60
msgid "Import"
msgstr "导入"
...
...
@@ -2321,6 +2332,7 @@ msgstr "日期"
#: ops/templates/ops/task_adhoc.html:63
#: terminal/templates/terminal/command_list.html:76
#: terminal/templates/terminal/session_detail.html:50
#: xpack/plugins/vault/templates/vault/vault.html:77
msgid "Datetime"
msgstr "日期"
...
...
@@ -2666,7 +2678,7 @@ msgstr "等待任务开始"
msgid "Interval"
msgstr "间隔"
#: ops/models/adhoc.py:38 settings/forms.py:15
1
#: ops/models/adhoc.py:38 settings/forms.py:15
8
msgid "Units: seconds"
msgstr "单位: 秒"
...
...
@@ -3003,7 +3015,7 @@ msgstr "命令执行"
msgid "Organization"
msgstr "组织管理"
#: perms/const.py:18 settings/forms.py:1
36
#: perms/const.py:18 settings/forms.py:1
43
msgid "All"
msgstr "全部"
...
...
@@ -3143,6 +3155,7 @@ msgstr "选择系统用户"
#: perms/templates/perms/asset_permission_list.html:46
#: perms/templates/perms/remote_app_permission_list.html:6
#: xpack/plugins/vault/templates/vault/vault.html:46
msgid "Create permission"
msgstr "创建授权规则"
...
...
@@ -3262,29 +3275,29 @@ msgstr "远程应用授权远程应用列表"
msgid "Test mail sent to {}, please check"
msgstr "邮件已经发送{}, 请检查"
#: settings/api.py:5
2
#: settings/api.py:5
4
msgid "Test ldap success"
msgstr "连接LDAP成功"
#: settings/api.py:
89
#: settings/api.py:
91
msgid "Match {} s users"
msgstr "匹配 {} 个用户"
#: settings/api.py:1
58
#: settings/api.py:1
60
msgid "succeed: {} failed: {} total: {}"
msgstr "成功:{} 失败:{} 总数:{}"
#: settings/api.py:18
0 settings/api.py:216
#: settings/api.py:18
2 settings/api.py:218
msgid ""
"Error: Account invalid (Please make sure the information such as Access key "
"or Secret key is correct)"
msgstr "错误:账户无效 (请确保 Access key 或 Secret key 等信息正确)"
#: settings/api.py:18
6 settings/api.py:222
#: settings/api.py:18
8 settings/api.py:224
msgid "Create succeed"
msgstr "创建成功"
#: settings/api.py:20
4 settings/api.py:242
#: settings/api.py:20
6 settings/api.py:244
#: settings/templates/settings/terminal_setting.html:154
msgid "Delete succeed"
msgstr "删除成功"
...
...
@@ -3325,56 +3338,64 @@ msgstr "SMTP账号"
msgid "SMTP password"
msgstr "SMTP密码"
#: settings/forms.py:8
3
msgid "Some provider use token except password"
msgstr "一些邮件提供商需要输入的是Token"
#: settings/forms.py:8
4
msgid "
Tips:
Some provider use token except password"
msgstr "
提示:
一些邮件提供商需要输入的是Token"
#: settings/forms.py:86
#: settings/forms.py:87
msgid "Send user"
msgstr "发送账号"
#: settings/forms.py:89
msgid "Tips: Send mail account, default SMTP account as the send account"
msgstr "提示:发送邮件账号,默认使用SMTP账号作为发送账号"
#: settings/forms.py:93
msgid "Use SSL"
msgstr "使用SSL"
#: settings/forms.py:
87
#: settings/forms.py:
94
msgid "If SMTP port is 465, may be select"
msgstr "如果SMTP端口是465,通常需要启用SSL"
#: settings/forms.py:9
0
#: settings/forms.py:9
7
msgid "Use TLS"
msgstr "使用TLS"
#: settings/forms.py:9
1
#: settings/forms.py:9
8
msgid "If SMTP port is 587, may be select"
msgstr "如果SMTP端口是587,通常需要启用TLS"
#: settings/forms.py:
97
#: settings/forms.py:
104
msgid "LDAP server"
msgstr "LDAP地址"
#: settings/forms.py:10
0
#: settings/forms.py:10
7
msgid "Bind DN"
msgstr "绑定DN"
#: settings/forms.py:1
07
#: settings/forms.py:1
14
msgid "User OU"
msgstr "用户OU"
#: settings/forms.py:1
08
#: settings/forms.py:1
15
msgid "Use | split User OUs"
msgstr "使用|分隔各OU"
#: settings/forms.py:11
2
#: settings/forms.py:11
9
msgid "User search filter"
msgstr "用户过滤器"
#: settings/forms.py:1
13
#: settings/forms.py:1
20
#, python-format
msgid "Choice may be (cn|uid|sAMAccountName)=%(user)s)"
msgstr "可能的选项是(cn或uid或sAMAccountName=%(user)s)"
#: settings/forms.py:1
16
#: settings/forms.py:1
23
msgid "User attr map"
msgstr "LDAP属性映射"
#: settings/forms.py:1
18
#: settings/forms.py:1
25
msgid ""
"User attr map present how to map LDAP user attr to jumpserver, username,name,"
"email is jumpserver attr"
...
...
@@ -3382,39 +3403,39 @@ msgstr ""
"用户属性映射代表怎样将LDAP中用户属性映射到jumpserver用户上,username, name,"
"email 是jumpserver的属性"
#: settings/forms.py:1
27
#: settings/forms.py:1
34
msgid "Enable LDAP auth"
msgstr "启用LDAP认证"
#: settings/forms.py:1
37
#: settings/forms.py:1
44
msgid "Auto"
msgstr "自动"
#: settings/forms.py:1
44
#: settings/forms.py:1
51
msgid "Password auth"
msgstr "密码认证"
#: settings/forms.py:1
47
#: settings/forms.py:1
54
msgid "Public key auth"
msgstr "密钥认证"
#: settings/forms.py:15
0
#: settings/forms.py:15
7
msgid "Heartbeat interval"
msgstr "心跳间隔"
#: settings/forms.py:1
54
#: settings/forms.py:1
61
msgid "List sort by"
msgstr "资产列表排序"
#: settings/forms.py:1
57
#: settings/forms.py:1
64
msgid "List page size"
msgstr "资产分页每页数量"
#: settings/forms.py:16
0
#: settings/forms.py:16
7
msgid "Session keep duration"
msgstr "会话保留时长"
#: settings/forms.py:16
1
#: settings/forms.py:16
8
msgid ""
"Units: days, Session, record, command will be delete if more than duration, "
"only in database"
...
...
@@ -3422,62 +3443,62 @@ msgstr ""
"单位:天。 会话、录像、命令记录超过该时长将会被删除(仅影响数据库存储, oss等不"
"受影响)"
#: settings/forms.py:1
65
#: settings/forms.py:1
72
msgid "Telnet login regex"
msgstr "Telnet 成功正则表达式"
#: settings/forms.py:1
66
#: settings/forms.py:1
73
msgid "ex: Last\\s*login|success|成功"
msgstr ""
"登录telnet服务器成功后的提示正则表达式,如: Last\\s*login|success|成功 "
#: settings/forms.py:1
77
#: settings/forms.py:1
84
msgid "MFA Secondary certification"
msgstr "MFA 二次认证"
#: settings/forms.py:1
79
#: settings/forms.py:1
86
msgid ""
"After opening, the user login must use MFA secondary authentication (valid "
"for all users, including administrators)"
msgstr "开启后,用户登录必须使用MFA二次认证(对所有用户有效,包括管理员)"
#: settings/forms.py:1
85
#: settings/forms.py:1
92
msgid "Batch execute commands"
msgstr "批量命令"
#: settings/forms.py:1
86
#: settings/forms.py:1
93
msgid "Allow user batch execute commands"
msgstr "允许用户批量执行命令"
#: settings/forms.py:19
1
#: settings/forms.py:19
8
msgid "Limit the number of login failures"
msgstr "限制登录失败次数"
#: settings/forms.py:
195
#: settings/forms.py:
202
msgid "No logon interval"
msgstr "禁止登录时间间隔"
#: settings/forms.py:
197
#: settings/forms.py:
204
msgid ""
"Tip: (unit/minute) if the user has failed to log in for a limited number of "
"times, no login is allowed during this time interval."
msgstr ""
"提示:(单位:分)当用户登录失败次数达到限制后,那么在此时间间隔内禁止登录"
#: settings/forms.py:2
04
#: settings/forms.py:2
11
msgid "Connection max idle time"
msgstr "SSH最大空闲时间"
#: settings/forms.py:2
06
#: settings/forms.py:2
13
msgid ""
"If idle time more than it, disconnect connection(only ssh now) Unit: minute"
msgstr "提示:(单位:分)如果超过该配置没有操作,连接会被断开(仅ssh)"
#: settings/forms.py:21
2
#: settings/forms.py:21
9
msgid "Password expiration time"
msgstr "密码过期时间"
#: settings/forms.py:2
14
#: settings/forms.py:2
21
msgid ""
"Tip: (unit: day) If the user does not update the password during the time, "
"the user password will expire failure;The password expiration reminder mail "
...
...
@@ -3487,81 +3508,81 @@ msgstr ""
"提示:(单位:天)如果用户在此期间没有更新密码,用户密码将过期失效; 密码过期"
"提醒邮件将在密码过期前5天内由系统(每天)自动发送给用户"
#: settings/forms.py:2
23
#: settings/forms.py:2
30
msgid "Password minimum length"
msgstr "密码最小长度 "
#: settings/forms.py:2
27
#: settings/forms.py:2
34
msgid "Must contain capital letters"
msgstr "必须包含大写字母"
#: settings/forms.py:2
29
#: settings/forms.py:2
36
msgid ""
"After opening, the user password changes and resets must contain uppercase "
"letters"
msgstr "开启后,用户密码修改、重置必须包含大写字母"
#: settings/forms.py:2
34
#: settings/forms.py:2
41
msgid "Must contain lowercase letters"
msgstr "必须包含小写字母"
#: settings/forms.py:2
35
#: settings/forms.py:2
42
msgid ""
"After opening, the user password changes and resets must contain lowercase "
"letters"
msgstr "开启后,用户密码修改、重置必须包含小写字母"
#: settings/forms.py:24
0
#: settings/forms.py:24
7
msgid "Must contain numeric characters"
msgstr "必须包含数字字符"
#: settings/forms.py:24
1
#: settings/forms.py:24
8
msgid ""
"After opening, the user password changes and resets must contain numeric "
"characters"
msgstr "开启后,用户密码修改、重置必须包含数字字符"
#: settings/forms.py:2
46
#: settings/forms.py:2
53
msgid "Must contain special characters"
msgstr "必须包含特殊字符"
#: settings/forms.py:2
47
#: settings/forms.py:2
54
msgid ""
"After opening, the user password changes and resets must contain special "
"characters"
msgstr "开启后,用户密码修改、重置必须包含特殊字符"
#: settings/forms.py:2
54
#: settings/forms.py:2
61
msgid "Create user email subject"
msgstr "创建用户邮件的主题"
#: settings/forms.py:2
55
#: settings/forms.py:2
62
msgid ""
"Tips: When creating a user, send the subject of the email (eg:Create account "
"successfully)"
msgstr "提示: 创建用户时,发送设置密码邮件的主题 (例如: 创建用户成功)"
#: settings/forms.py:2
59
#: settings/forms.py:2
66
msgid "Create user honorific"
msgstr "创建用户邮件的敬语"
#: settings/forms.py:26
0
#: settings/forms.py:26
7
msgid "Tips: When creating a user, send the honorific of the email (eg:Hello)"
msgstr "提示: 创建用户时,发送设置密码邮件的敬语 (例如: 您好)"
#: settings/forms.py:2
65
#: settings/forms.py:2
72
msgid "Create user email content"
msgstr "创建用户邮件的内容"
#: settings/forms.py:2
66
#: settings/forms.py:2
73
msgid "Tips:When creating a user, send the content of the email"
msgstr "提示: 创建用户时,发送设置密码邮件的内容"
#: settings/forms.py:2
69
#: settings/forms.py:2
76
msgid "Signature"
msgstr "署名"
#: settings/forms.py:27
0
#: settings/forms.py:27
7
msgid "Tips: Email signature (eg:jumpserver)"
msgstr "提示: 邮件的署名 (例如: jumpserver)"
...
...
@@ -5920,6 +5941,14 @@ msgstr "创建组织"
msgid "Update org"
msgstr "更新组织"
#: xpack/plugins/vault/meta.py:11 xpack/plugins/vault/views.py:16
msgid "Vault"
msgstr "密码匣子"
#: xpack/plugins/vault/views.py:17
msgid "vault list"
msgstr "密码匣子"
#~ msgid "User does not exist"
#~ msgstr "用户不存在"
...
...
apps/settings/api.py
View file @
7715e62d
...
...
@@ -30,6 +30,7 @@ class MailTestingAPI(APIView):
def
post
(
self
,
request
):
serializer
=
self
.
serializer_class
(
data
=
request
.
data
)
if
serializer
.
is_valid
():
email_from
=
serializer
.
validated_data
[
"EMAIL_FROM"
]
email_host_user
=
serializer
.
validated_data
[
"EMAIL_HOST_USER"
]
for
k
,
v
in
serializer
.
validated_data
.
items
():
if
k
.
startswith
(
'EMAIL'
):
...
...
@@ -37,7 +38,8 @@ class MailTestingAPI(APIView):
try
:
subject
=
"Test"
message
=
"Test smtp setting"
send_mail
(
subject
,
message
,
email_host_user
,
[
email_host_user
])
email_from
=
email_from
or
email_host_user
send_mail
(
subject
,
message
,
email_from
,
[
email_host_user
])
except
Exception
as
e
:
return
Response
({
"error"
:
str
(
e
)},
status
=
401
)
...
...
apps/settings/forms.py
View file @
7715e62d
...
...
@@ -80,7 +80,14 @@ class EmailSettingForm(BaseForm):
)
EMAIL_HOST_PASSWORD
=
FormEncryptCharField
(
max_length
=
1024
,
label
=
_
(
"SMTP password"
),
widget
=
forms
.
PasswordInput
,
required
=
False
,
help_text
=
_
(
"Some provider use token except password"
)
required
=
False
,
help_text
=
_
(
"Tips: Some provider use token except password"
)
)
EMAIL_FROM
=
forms
.
CharField
(
max_length
=
128
,
label
=
_
(
"Send user"
),
initial
=
''
,
required
=
False
,
help_text
=
_
(
"Tips: Send mail account, default SMTP account as the send account"
)
)
EMAIL_USE_SSL
=
forms
.
BooleanField
(
label
=
_
(
"Use SSL"
),
initial
=
False
,
required
=
False
,
...
...
apps/settings/serializers.py
View file @
7715e62d
...
...
@@ -6,6 +6,7 @@ class MailTestSerializer(serializers.Serializer):
EMAIL_PORT
=
serializers
.
IntegerField
(
default
=
25
)
EMAIL_HOST_USER
=
serializers
.
CharField
(
max_length
=
1024
)
EMAIL_HOST_PASSWORD
=
serializers
.
CharField
()
EMAIL_FROM
=
serializers
.
CharField
(
required
=
False
,
allow_blank
=
True
)
EMAIL_USE_SSL
=
serializers
.
BooleanField
(
default
=
False
)
EMAIL_USE_TLS
=
serializers
.
BooleanField
(
default
=
False
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment