Commit a654bbef authored by ibuler's avatar ibuler

[Update] Merge

parents 62c1b488 c3a206b2
......@@ -212,12 +212,13 @@ class AssetsAmountMixin:
if cached is not None:
return cached
assets_amount = self.get_all_assets().count()
cache.set(cache_key, assets_amount, self.cache_time)
return assets_amount
@assets_amount.setter
def assets_amount(self, value):
self._assets_amount = value
cache_key = self._assets_amount_cache_key.format(self.key)
cache.set(cache_key, value, self.cache_time)
def expire_assets_amount(self):
ancestor_keys = self.get_ancestor_keys(with_self=True)
......
......@@ -59,6 +59,7 @@ class AuthSerializerMixin:
value = validated_data.get(field)
if not value:
validated_data.pop(field, None)
# print(validated_data)
# raise serializers.ValidationError(">>>>>>")
......
......@@ -3,6 +3,7 @@ from rest_framework import serializers
from django.utils.translation import ugettext_lazy as _
from common.serializers import AdaptedBulkListSerializer
from common.utils import ssh_pubkey_gen
from orgs.mixins import BulkOrgResourceModelSerializer
from ..models import SystemUser
from .base import AuthSerializer, AuthSerializerMixin
......@@ -71,7 +72,9 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
super().validate_password(password)
auto_gen_key = self.initial_data.get("auto_generate_key", False)
private_key = self.initial_data.get("private_key")
if not self.instance and not auto_gen_key and not password and not private_key:
login_mode = self.initial_data.get("login_mode")
if not self.instance and not auto_gen_key and not password and \
not private_key and login_mode == SystemUser.LOGIN_AUTO:
raise serializers.ValidationError(_("Password or private key required"))
return password
......@@ -86,6 +89,13 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
private_key, public_key = SystemUser.gen_key(username)
attrs["private_key"] = private_key
attrs["public_key"] = public_key
# 如果设置了private key,没有设置public key则生成
elif attrs.get("private_key", None):
private_key = attrs["private_key"]
password = attrs.get("password")
public_key = ssh_pubkey_gen(private_key, password=password,
username=username)
attrs["public_key"] = public_key
attrs.pop("auto_generate_key", None)
return attrs
......
......@@ -5,6 +5,8 @@ from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import gettext_lazy as _
from captcha.fields import CaptchaField
from django.conf import settings
from users.utils import get_login_failed_count
class UserLoginForm(AuthenticationForm):
......@@ -16,10 +18,18 @@ class UserLoginForm(AuthenticationForm):
error_messages = {
'invalid_login': _(
"Please enter a correct username and password. Note that both "
"fields may be case-sensitive."
"The username or password you entered is incorrect, "
"please enter it again."
),
'inactive': _("This account is inactive."),
'limit_login': _(
"You can also try {times_try} times "
"(The account will be temporarily locked for {block_time} minutes)"
),
'block_login': _(
"The account has been locked "
"(please contact admin to unlock it or try again after {} minutes)"
)
}
def confirm_login_allowed(self, user):
......@@ -28,6 +38,25 @@ class UserLoginForm(AuthenticationForm):
self.error_messages['inactive'],
code='inactive',)
def get_limit_login_error_message(self, username, ip):
times_up = settings.SECURITY_LOGIN_LIMIT_COUNT
times_failed = get_login_failed_count(username, ip)
times_try = int(times_up) - int(times_failed)
block_time = settings.SECURITY_LOGIN_LIMIT_TIME
if times_try <= 0:
error_message = self.error_messages['block_login']
error_message = error_message.format(block_time)
else:
error_message = self.error_messages['limit_login']
error_message = error_message.format(
times_try=times_try, block_time=block_time,
)
return error_message
def add_limit_login_error(self, username, ip):
error = self.get_limit_login_error_message(username, ip)
self.add_error('password', error)
class UserLoginCaptchaForm(UserLoginForm):
captcha = CaptchaField()
......
......@@ -58,6 +58,7 @@
{% else %}
<p class="red-fonts">{{ form.non_field_errors.as_text }}</p>
{% endif %}
<p class="red-fonts">{{ form.errors.password.as_text }}</p>
{% endif %}
<div class="form-group">
......@@ -83,6 +84,7 @@
<small>{% trans 'Forgot password' %}?</small>
</a>
</div>
</div>
{% if AUTH_OPENID %}
<div class="hr-line-dashed"></div>
......
......@@ -72,9 +72,10 @@
<div class="contact-form col-md-10" style="margin-top: 10px;height: 35px">
<form id="contact-form" action="" method="post" role="form" novalidate="novalidate">
{% csrf_token %}
<div style="height: 45px;color: red;line-height: 17px;">
<div style="height: 70px;color: red;line-height: 17px;">
{% if block_login %}
<p class="red-fonts">{% trans 'Log in frequently and try again later' %}</p>
<p class="red-fonts">{{ form.errors.password.as_text }}</p>
{% elif password_expired %}
<p class="red-fonts">{% trans 'The user password has expired' %}</p>
{% elif form.errors %}
......@@ -83,6 +84,7 @@
{% else %}
<p class="red-fonts">{{ form.non_field_errors.as_text }}</p>
{% endif %}
<p class="red-fonts">{{ form.errors.password.as_text }}</p>
{% endif %}
</div>
......
......@@ -101,6 +101,7 @@ class UserLoginView(FormView):
# limit user login failed count
ip = get_request_ip(self.request)
increase_login_failed_count(username, ip)
form.add_limit_login_error(username, ip)
# show captcha
cache.set(self.key_prefix_captcha.format(ip), 1, 3600)
self.send_auth_signal(success=False, username=username, reason=reason)
......
......@@ -49,6 +49,8 @@ class IsOrgAdmin(IsValidUser):
"""Allows access only to superuser"""
def has_permission(self, request, view):
if not current_org:
return False
return super(IsOrgAdmin, self).has_permission(request, view) \
and current_org.can_admin_by(request.user)
......@@ -57,6 +59,8 @@ class IsOrgAdminOrAppUser(IsValidUser):
"""Allows access between superuser and app user"""
def has_permission(self, request, view):
if not current_org:
return False
return super(IsOrgAdminOrAppUser, self).has_permission(request, view) \
and (current_org.can_admin_by(request.user) or request.user.is_app)
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-30 12:52+0800\n"
"POT-Creation-Date: 2019-08-07 16:56+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"
......@@ -78,7 +78,7 @@ msgstr "运行参数"
#: assets/forms/domain.py:15 assets/forms/label.py:13
#: assets/models/asset.py:318 assets/models/authbook.py:24
#: assets/serializers/admin_user.py:32 assets/serializers/asset_user.py:81
#: assets/serializers/system_user.py:30
#: assets/serializers/system_user.py:31
#: assets/templates/assets/admin_user_list.html:46
#: assets/templates/assets/domain_detail.html:60
#: assets/templates/assets/domain_list.html:26
......@@ -101,7 +101,7 @@ msgstr "运行参数"
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_list.html:54
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_subtask_list.html:13
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:14
#: xpack/plugins/cloud/models.py:187
#: xpack/plugins/cloud/models.py:310
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:63
#: xpack/plugins/orgs/templates/orgs/org_list.html:16
#: xpack/plugins/vault/forms.py:13 xpack/plugins/vault/forms.py:15
......@@ -178,10 +178,10 @@ msgstr "系统用户"
#: xpack/plugins/change_auth_plan/models.py:61
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:61
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:12
#: xpack/plugins/cloud/models.py:49 xpack/plugins/cloud/models.py:119
#: xpack/plugins/cloud/models.py:59 xpack/plugins/cloud/models.py:144
#: xpack/plugins/cloud/templates/cloud/account_detail.html:50
#: xpack/plugins/cloud/templates/cloud/account_list.html:12
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:53
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:56
#: 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
......@@ -222,7 +222,7 @@ msgstr "参数"
#: users/templates/users/user_detail.html:111
#: xpack/plugins/change_auth_plan/models.py:106
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:113
#: xpack/plugins/cloud/models.py:55 xpack/plugins/cloud/models.py:127
#: xpack/plugins/cloud/models.py:80 xpack/plugins/cloud/models.py:179
msgid "Created by"
msgstr "创建者"
......@@ -245,9 +245,9 @@ msgstr "创建者"
#: terminal/templates/terminal/terminal_detail.html:59 users/models/group.py:17
#: users/templates/users/user_group_detail.html:63
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:105
#: xpack/plugins/cloud/models.py:56 xpack/plugins/cloud/models.py:128
#: xpack/plugins/cloud/models.py:83 xpack/plugins/cloud/models.py:182
#: xpack/plugins/cloud/templates/cloud/account_detail.html:66
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:77
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:101
#: xpack/plugins/orgs/templates/orgs/org_detail.html:60
msgid "Date created"
msgstr "创建日期"
......@@ -286,11 +286,11 @@ msgstr "创建日期"
#: xpack/plugins/change_auth_plan/models.py:102
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:117
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:19
#: xpack/plugins/cloud/models.py:54 xpack/plugins/cloud/models.py:125
#: xpack/plugins/cloud/models.py:77 xpack/plugins/cloud/models.py:173
#: xpack/plugins/cloud/templates/cloud/account_detail.html:70
#: xpack/plugins/cloud/templates/cloud/account_list.html:15
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:69
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:16
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:105
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:18
#: xpack/plugins/orgs/templates/orgs/org_detail.html:64
#: xpack/plugins/orgs/templates/orgs/org_list.html:22
msgid "Comment"
......@@ -338,7 +338,7 @@ msgstr "远程应用"
#: users/templates/users/user_pubkey_update.html:80
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_create_update.html:71
#: xpack/plugins/cloud/templates/cloud/account_create_update.html:33
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create.html:35
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:53
#: xpack/plugins/interface/templates/interface/interface.html:72
#: xpack/plugins/vault/templates/vault/vault_create.html:45
msgid "Reset"
......@@ -429,27 +429,29 @@ msgstr "详情"
#: assets/templates/assets/system_user_list.html:33
#: assets/templates/assets/system_user_list.html:85 audits/models.py:33
#: perms/templates/perms/asset_permission_detail.html:30
#: perms/templates/perms/asset_permission_list.html:177
#: perms/templates/perms/asset_permission_list.html:178
#: perms/templates/perms/remote_app_permission_detail.html:30
#: perms/templates/perms/remote_app_permission_list.html:59
#: terminal/templates/terminal/terminal_detail.html:16
#: terminal/templates/terminal/terminal_list.html:72
#: terminal/templates/terminal/terminal_list.html:73
#: users/templates/users/user_detail.html:25
#: users/templates/users/user_group_detail.html:28
#: users/templates/users/user_group_list.html:20
#: users/templates/users/user_group_list.html:70
#: users/templates/users/user_group_list.html:71
#: users/templates/users/user_list.html:20
#: users/templates/users/user_list.html:102
#: users/templates/users/user_list.html:105
#: users/templates/users/user_list.html:103
#: users/templates/users/user_list.html:106
#: users/templates/users/user_profile.html:181
#: users/templates/users/user_profile.html:191
#: users/templates/users/user_profile.html:201
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:29
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:55
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:56
#: xpack/plugins/cloud/templates/cloud/account_detail.html:23
#: xpack/plugins/cloud/templates/cloud/account_list.html:39
#: xpack/plugins/cloud/templates/cloud/account_list.html:40
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:29
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:57
#: xpack/plugins/orgs/templates/orgs/org_detail.html:25
#: xpack/plugins/orgs/templates/orgs/org_list.html:87
#: xpack/plugins/orgs/templates/orgs/org_list.html:88
msgid "Update"
msgstr "更新"
......@@ -472,25 +474,25 @@ msgstr "更新"
#: authentication/templates/authentication/_access_key_modal.html:65
#: ops/templates/ops/task_list.html:64
#: perms/templates/perms/asset_permission_detail.html:34
#: perms/templates/perms/asset_permission_list.html:178
#: perms/templates/perms/asset_permission_list.html:179
#: perms/templates/perms/remote_app_permission_detail.html:34
#: perms/templates/perms/remote_app_permission_list.html:60
#: settings/templates/settings/terminal_setting.html:93
#: settings/templates/settings/terminal_setting.html:115
#: terminal/templates/terminal/terminal_list.html:74
#: terminal/templates/terminal/terminal_list.html:75
#: users/templates/users/user_detail.html:30
#: users/templates/users/user_group_detail.html:32
#: users/templates/users/user_group_list.html:72
#: users/templates/users/user_list.html:110
#: users/templates/users/user_list.html:114
#: users/templates/users/user_group_list.html:73
#: users/templates/users/user_list.html:111
#: users/templates/users/user_list.html:115
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:33
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:57
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:58
#: xpack/plugins/cloud/templates/cloud/account_detail.html:27
#: xpack/plugins/cloud/templates/cloud/account_list.html:41
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:30
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:55
#: xpack/plugins/cloud/templates/cloud/account_list.html:42
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:33
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:58
#: xpack/plugins/orgs/templates/orgs/org_detail.html:29
#: xpack/plugins/orgs/templates/orgs/org_list.html:89
#: xpack/plugins/orgs/templates/orgs/org_list.html:90
msgid "Delete"
msgstr "删除"
......@@ -545,7 +547,8 @@ msgstr "创建远程应用"
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_subtask_list.html:18
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:20
#: xpack/plugins/cloud/templates/cloud/account_list.html:16
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:18
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:72
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:19
#: xpack/plugins/orgs/templates/orgs/org_list.html:23
msgid "Action"
msgstr "动作"
......@@ -628,8 +631,8 @@ msgstr "节点"
#: assets/forms/asset.py:48 assets/forms/asset.py:83 assets/models/asset.py:172
#: assets/models/cluster.py:19 assets/models/user.py:68
#: assets/templates/assets/asset_detail.html:76 templates/_nav.html:24
#: xpack/plugins/cloud/models.py:124
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:65
#: xpack/plugins/cloud/models.py:161
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:68
#: xpack/plugins/orgs/templates/orgs/org_list.html:18
msgid "Admin user"
msgstr "管理用户"
......@@ -651,7 +654,7 @@ msgid "Domain"
msgstr "网域"
#: assets/forms/asset.py:58 assets/forms/asset.py:80 assets/forms/asset.py:93
#: assets/forms/asset.py:128 assets/models/node.py:253
#: assets/forms/asset.py:128 assets/models/node.py:254
#: assets/templates/assets/asset_create.html:42
#: perms/forms/asset_permission.py:72 perms/forms/asset_permission.py:79
#: perms/models/asset_permission.py:112
......@@ -661,8 +664,8 @@ msgstr "网域"
#: xpack/plugins/change_auth_plan/forms.py:116
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_list.html:55
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:15
#: xpack/plugins/cloud/models.py:123
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:61
#: xpack/plugins/cloud/models.py:157
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:64
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:64
msgid "Node"
msgstr "节点"
......@@ -714,9 +717,9 @@ msgstr "SSH网关,支持代理SSH,RDP和VNC"
#: assets/templates/assets/domain_gateway_list.html:71
#: assets/templates/assets/system_user_detail.html:62
#: assets/templates/assets/system_user_list.html:52 audits/models.py:80
#: audits/templates/audits/login_log_list.html:51 authentication/forms.py:11
#: authentication/templates/authentication/login.html:64
#: authentication/templates/authentication/new_login.html:90
#: audits/templates/audits/login_log_list.html:51 authentication/forms.py:13
#: authentication/templates/authentication/login.html:65
#: authentication/templates/authentication/new_login.html:92
#: ops/models/adhoc.py:164 perms/templates/perms/asset_permission_list.html:70
#: perms/templates/perms/asset_permission_user.html:55
#: perms/templates/perms/remote_app_permission_user.html:54
......@@ -743,9 +746,9 @@ msgstr "密码或密钥密码"
#: assets/serializers/asset_user.py:62
#: assets/templates/assets/_asset_user_auth_update_modal.html:21
#: assets/templates/assets/_asset_user_auth_view_modal.html:27
#: authentication/forms.py:13
#: authentication/templates/authentication/login.html:67
#: authentication/templates/authentication/new_login.html:93
#: authentication/forms.py:15
#: authentication/templates/authentication/login.html:68
#: authentication/templates/authentication/new_login.html:95
#: settings/forms.py:110 users/forms.py:16 users/forms.py:28
#: users/templates/users/reset_password.html:53
#: users/templates/users/user_password_authentication.html:18
......@@ -992,7 +995,7 @@ msgid "Default"
msgstr "默认"
#: assets/models/cluster.py:36 assets/models/label.py:14
#: users/models/user.py:458
#: users/models/user.py:470
msgid "System"
msgstr "系统"
......@@ -1111,7 +1114,7 @@ msgstr "默认资产组"
#: terminal/templates/terminal/command_list.html:65
#: terminal/templates/terminal/session_list.html:27
#: terminal/templates/terminal/session_list.html:71 users/forms.py:316
#: users/models/user.py:127 users/models/user.py:446
#: users/models/user.py:127 users/models/user.py:458
#: users/serializers/v1.py:108 users/templates/users/user_group_detail.html:78
#: users/templates/users/user_group_list.html:36 users/views/user.py:243
#: xpack/plugins/orgs/forms.py:26
......@@ -1120,7 +1123,7 @@ msgstr "默认资产组"
msgid "User"
msgstr "用户"
#: assets/models/label.py:19 assets/models/node.py:244
#: assets/models/label.py:19 assets/models/node.py:245
#: assets/templates/assets/label_list.html:15 settings/models.py:30
msgid "Value"
msgstr "值"
......@@ -1129,11 +1132,11 @@ msgstr "值"
msgid "Category"
msgstr "分类"
#: assets/models/node.py:243
#: assets/models/node.py:244
msgid "Key"
msgstr "键"
#: assets/models/node.py:301
#: assets/models/node.py:302
msgid "New node"
msgstr "新节点"
......@@ -1239,15 +1242,15 @@ msgstr "密钥不合法"
msgid "The same level node name cannot be the same"
msgstr "同级别节点名字不能重复"
#: assets/serializers/system_user.py:31
#: assets/serializers/system_user.py:32
msgid "Login mode display"
msgstr "登录模式显示"
#: assets/serializers/system_user.py:66
#: assets/serializers/system_user.py:67
msgid "* Automatic login mode must fill in the username."
msgstr "自动登录模式,必须填写用户名"
#: assets/serializers/system_user.py:75
#: assets/serializers/system_user.py:78
msgid "Password or private key required"
msgstr "密码或密钥密码需要一个"
......@@ -1307,30 +1310,30 @@ msgstr "测试系统用户可连接性: {} => {}"
msgid "Test system user connectivity period: {}"
msgstr "定期测试系统用户可连接性: {}"
#: assets/tasks.py:470 assets/tasks.py:556
#: assets/tasks.py:478 assets/tasks.py:564
#: xpack/plugins/change_auth_plan/models.py:522
msgid "The asset {} system platform {} does not support run Ansible tasks"
msgstr "资产 {} 系统平台 {} 不支持运行 Ansible 任务"
#: assets/tasks.py:482
#: assets/tasks.py:490
msgid ""
"Push system user task skip, auto push not enable or protocol is not ssh or "
"rdp: {}"
msgstr "推送系统用户任务跳过,自动推送没有打开,或协议不是ssh或rdp: {}"
#: assets/tasks.py:489
#: assets/tasks.py:497
msgid "For security, do not push user {}"
msgstr "为了安全,禁止推送用户 {}"
#: assets/tasks.py:517 assets/tasks.py:531
#: assets/tasks.py:525 assets/tasks.py:539
msgid "Push system users to assets: {}"
msgstr "推送系统用户到入资产: {}"
#: assets/tasks.py:523
#: assets/tasks.py:531
msgid "Push system users to asset: {} => {}"
msgstr "推送系统用户到入资产: {} => {}"
#: assets/tasks.py:603
#: assets/tasks.py:611
msgid "Test asset user connectivity: {}"
msgstr "测试资产用户可连接性: {}"
......@@ -1499,6 +1502,7 @@ msgstr "重命名成功"
#: perms/templates/perms/asset_permission_create_update.html:38
#: perms/templates/perms/remote_app_permission_create_update.html:39
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_create_update.html:43
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:27
msgid "Basic"
msgstr "基本"
......@@ -1520,6 +1524,7 @@ msgstr "自动生成密钥"
#: perms/templates/perms/remote_app_permission_create_update.html:52
#: terminal/templates/terminal/terminal_update.html:40
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_create_update.html:67
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:48
msgid "Other"
msgstr "其它"
......@@ -1589,10 +1594,10 @@ msgstr "选择节点"
#: users/templates/users/user_detail.html:441
#: users/templates/users/user_detail.html:486
#: users/templates/users/user_group_create_update.html:32
#: users/templates/users/user_group_list.html:119
#: users/templates/users/user_list.html:255
#: users/templates/users/user_group_list.html:120
#: users/templates/users/user_list.html:256
#: xpack/plugins/cloud/templates/cloud/account_create_update.html:34
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create.html:36
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:54
#: xpack/plugins/interface/templates/interface/interface.html:103
#: xpack/plugins/orgs/templates/orgs/org_create_update.html:33
msgid "Confirm"
......@@ -1643,10 +1648,10 @@ msgstr "创建管理用户"
#: assets/templates/assets/asset_list.html:304
#: assets/templates/assets/system_user_list.html:192
#: assets/templates/assets/system_user_list.html:223
#: users/templates/users/user_group_list.html:163
#: users/templates/users/user_group_list.html:194
#: users/templates/users/user_list.html:164
#: users/templates/users/user_list.html:196
#: users/templates/users/user_group_list.html:164
#: users/templates/users/user_group_list.html:195
#: users/templates/users/user_list.html:165
#: users/templates/users/user_list.html:197
#: xpack/plugins/vault/templates/vault/vault.html:224
msgid "Please select file"
msgstr "选择文件"
......@@ -1666,6 +1671,7 @@ msgstr "资产用户"
#: users/templates/users/user_detail.html:140
#: users/templates/users/user_profile.html:150
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:128
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:132
#: xpack/plugins/license/templates/license/license_detail.html:102
msgid "Quick modify"
msgstr "快速修改"
......@@ -1786,8 +1792,8 @@ msgstr "显示所有子节点资产"
#: users/templates/users/user_detail.html:386
#: users/templates/users/user_detail.html:412
#: users/templates/users/user_detail.html:480
#: users/templates/users/user_group_list.html:113
#: users/templates/users/user_list.html:249
#: users/templates/users/user_group_list.html:114
#: users/templates/users/user_list.html:250
#: xpack/plugins/interface/templates/interface/interface.html:97
msgid "Are you sure?"
msgstr "你确认吗?"
......@@ -1803,8 +1809,8 @@ msgstr "删除选择资产"
#: users/templates/users/user_detail.html:416
#: users/templates/users/user_detail.html:484
#: users/templates/users/user_group_create_update.html:31
#: users/templates/users/user_group_list.html:117
#: users/templates/users/user_list.html:253
#: users/templates/users/user_group_list.html:118
#: users/templates/users/user_list.html:254
#: xpack/plugins/interface/templates/interface/interface.html:101
#: xpack/plugins/orgs/templates/orgs/org_create_update.html:32
msgid "Cancel"
......@@ -2169,8 +2175,8 @@ msgstr "启用"
msgid "-"
msgstr ""
#: audits/models.py:77 xpack/plugins/cloud/models.py:164
#: xpack/plugins/cloud/models.py:178
#: audits/models.py:77 xpack/plugins/cloud/models.py:267
#: xpack/plugins/cloud/models.py:290
msgid "Failed"
msgstr "失败"
......@@ -2200,13 +2206,13 @@ msgstr "MFA"
#: audits/models.py:86 audits/templates/audits/login_log_list.html:57
#: xpack/plugins/change_auth_plan/models.py:417
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_subtask_list.html:15
#: xpack/plugins/cloud/models.py:172
#: xpack/plugins/cloud/models.py:281
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:69
msgid "Reason"
msgstr "原因"
#: audits/models.py:87 audits/templates/audits/login_log_list.html:58
#: xpack/plugins/cloud/models.py:171 xpack/plugins/cloud/models.py:188
#: xpack/plugins/cloud/models.py:278 xpack/plugins/cloud/models.py:313
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:70
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:65
msgid "Status"
......@@ -2394,17 +2400,29 @@ msgstr "密码过期"
msgid "Disabled or expired"
msgstr "禁用或失效"
#: authentication/forms.py:19
#: authentication/forms.py:21
msgid ""
"Please enter a correct username and password. Note that both fields may be "
"case-sensitive."
msgstr "请输入正确的用户名和密码. 注意它们是区分大小写."
"The username or password you entered is incorrect, please enter it again."
msgstr "您输入的用户名或密码不正确,请重新输入。"
#: authentication/forms.py:22
#: authentication/forms.py:24
msgid "This account is inactive."
msgstr "此账户无效"
#: authentication/forms.py:37 users/forms.py:22
#: authentication/forms.py:26
#, python-brace-format
msgid ""
"You can also try {times_try} times (The account will be temporarily locked "
"for {block_time} minutes)"
msgstr "您还可以尝试 {times_try} 次(账号将被临时锁定 {block_time} 分钟)"
#: authentication/forms.py:30
msgid ""
"The account has been locked (please contact admin to unlock it or try again "
"after {} minutes)"
msgstr "账号已被锁定(请联系管理员解锁 或 {}分钟后重试)"
#: authentication/forms.py:66 users/forms.py:22
msgid "MFA code"
msgstr "MFA 验证码"
......@@ -2501,34 +2519,34 @@ msgid "Changes the world, starting with a little bit."
msgstr "改变世界,从一点点开始。"
#: authentication/templates/authentication/login.html:46
#: authentication/templates/authentication/login.html:72
#: authentication/templates/authentication/new_login.html:99
#: authentication/templates/authentication/login.html:73
#: authentication/templates/authentication/new_login.html:101
#: templates/_header_bar.html:83
msgid "Login"
msgstr "登录"
#: authentication/templates/authentication/login.html:54
#: authentication/templates/authentication/new_login.html:79
#: authentication/templates/authentication/new_login.html:80
msgid "The user password has expired"
msgstr "用户密码已过期"
#: authentication/templates/authentication/login.html:57
#: authentication/templates/authentication/new_login.html:82
#: authentication/templates/authentication/new_login.html:83
msgid "Captcha invalid"
msgstr "验证码错误"
#: authentication/templates/authentication/login.html:83
#: authentication/templates/authentication/new_login.html:103
#: authentication/templates/authentication/login.html:84
#: authentication/templates/authentication/new_login.html:105
#: users/templates/users/forgot_password.html:10
#: users/templates/users/forgot_password.html:25
msgid "Forgot password"
msgstr "忘记密码"
#: authentication/templates/authentication/login.html:89
#: authentication/templates/authentication/login.html:91
msgid "More login options"
msgstr "更多登录方式"
#: authentication/templates/authentication/login.html:93
#: authentication/templates/authentication/login.html:95
msgid "Keycloak"
msgstr ""
......@@ -2573,20 +2591,20 @@ msgstr "如果不能提供MFA验证码,请联系管理员!"
msgid "Welcome back, please enter username and password to login"
msgstr "欢迎回来,请输入用户名和密码登录"
#: authentication/views/login.py:80
#: authentication/views/login.py:81
msgid "Please enable cookies and try again."
msgstr "设置你的浏览器支持cookie"
#: authentication/views/login.py:172 users/views/user.py:386
#: authentication/views/login.py:174 users/views/user.py:386
#: users/views/user.py:411
msgid "MFA code invalid, or ntp sync server time"
msgstr "MFA验证码不正确,或者服务器端时间不对"
#: authentication/views/login.py:203
#: authentication/views/login.py:205
msgid "Logout success"
msgstr "退出登录成功"
#: authentication/views/login.py:204
#: authentication/views/login.py:206
msgid "Logout success, return login page"
msgstr "退出登录成功,返回到登录页面"
......@@ -2791,7 +2809,7 @@ msgstr "汇总"
#: ops/models/command.py:22
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_list.html:56
#: xpack/plugins/cloud/models.py:170
#: xpack/plugins/cloud/models.py:276
msgid "Result"
msgstr "结果"
......@@ -2990,8 +3008,9 @@ msgstr "版本"
#: ops/templates/ops/task_list.html:63
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:137
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:53
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:53
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:54
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:141
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:55
msgid "Run"
msgstr "执行"
......@@ -3195,13 +3214,13 @@ msgstr "刷新授权缓存"
#: perms/templates/perms/asset_permission_list.html:55
#: perms/templates/perms/asset_permission_list.html:69
#: perms/templates/perms/remote_app_permission_list.html:18
#: users/templates/users/user_list.html:40 xpack/plugins/cloud/models.py:53
#: users/templates/users/user_list.html:40 xpack/plugins/cloud/models.py:74
#: xpack/plugins/cloud/templates/cloud/account_detail.html:58
#: xpack/plugins/cloud/templates/cloud/account_list.html:14
msgid "Validity"
msgstr "有效"
#: perms/templates/perms/asset_permission_list.html:244
#: perms/templates/perms/asset_permission_list.html:245
msgid "Refresh success"
msgstr "刷新成功"
......@@ -3793,8 +3812,8 @@ msgid "Endpoint suffix"
msgstr "端点后缀"
#: settings/templates/settings/replay_storage_create.html:136
#: xpack/plugins/cloud/models.py:186
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:81
#: xpack/plugins/cloud/models.py:307
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:109
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:62
msgid "Region"
msgstr "地域"
......@@ -3919,7 +3938,24 @@ msgstr "下载导入模版"
msgid "Select the CSV file to import"
msgstr "请选择csv文件导入"
#: templates/_message.html:7
#: templates/_message.html:6
msgid ""
"\n"
" Your account has expired, please contact the administrator.\n"
" "
msgstr ""
"\n"
" 您的账户已经过期,请联系管理员。 "
#: templates/_message.html:13
msgid "Your account will at"
msgstr "您的账户将于"
#: templates/_message.html:13 templates/_message.html:30
msgid "expired. "
msgstr "过期。"
#: templates/_message.html:23
#, python-format
msgid ""
"\n"
......@@ -3932,15 +3968,11 @@ msgstr ""
"\"%(user_password_update_url)s\"> 链接 </a> 更新密码\n"
" "
#: templates/_message.html:14
#: templates/_message.html:30
msgid "Your password will at"
msgstr "您的密码将于"
#: templates/_message.html:14
msgid "expired. "
msgstr "过期。"
#: templates/_message.html:15
#: templates/_message.html:31
#, python-format
msgid ""
"\n"
......@@ -3953,7 +3985,7 @@ msgstr ""
"新密码\n"
" "
#: templates/_message.html:27
#: templates/_message.html:43
#, python-format
msgid ""
"\n"
......@@ -3966,7 +3998,7 @@ msgstr ""
"</a> 补充完整\n"
" "
#: templates/_message.html:40
#: templates/_message.html:56
#, python-format
msgid ""
"\n"
......@@ -4385,11 +4417,11 @@ msgstr "地址"
msgid "Alive"
msgstr "在线"
#: terminal/templates/terminal/terminal_list.html:77
#: terminal/templates/terminal/terminal_list.html:78
msgid "Accept"
msgstr "接受"
#: terminal/templates/terminal/terminal_list.html:79
#: terminal/templates/terminal/terminal_list.html:80
msgid "Reject"
msgstr "拒绝"
......@@ -4553,7 +4585,7 @@ msgstr "选择用户"
msgid "User auth from {}, go there change password"
msgstr "用户认证源来自 {}, 请去相应系统修改密码"
#: users/models/user.py:126 users/models/user.py:454
#: users/models/user.py:126 users/models/user.py:466
msgid "Administrator"
msgstr "管理员"
......@@ -4565,6 +4597,16 @@ msgstr "应用程序"
msgid "Auditor"
msgstr "审计员"
# #: users/models/user.py:288 users/templates/users/user_profile.html:94
# #: users/templates/users/user_profile.html:163
# #: users/templates/users/user_profile.html:166
# msgid "Disable"
# msgstr "禁用"
#
# #: users/models/user.py:289 users/templates/users/user_profile.html:92
# #: users/templates/users/user_profile.html:170
# msgid "Enable"
# msgstr "启用"
#: users/models/user.py:290 users/templates/users/user_profile.html:90
msgid "Force enable"
msgstr "强制启用"
......@@ -4587,7 +4629,7 @@ msgstr "用户来源"
msgid "Date password last updated"
msgstr "最后更新密码日期"
#: users/models/user.py:457
#: users/models/user.py:469
msgid "Administrator is the super user of system"
msgstr "Administrator是初始的超级管理员"
......@@ -4641,8 +4683,8 @@ msgstr "安全令牌验证"
#: users/templates/users/_base_otp.html:44 users/templates/users/_user.html:13
#: users/templates/users/user_profile_update.html:55
#: xpack/plugins/cloud/models.py:120
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:57
#: xpack/plugins/cloud/models.py:147
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:60
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:13
msgid "Account"
msgstr "账户"
......@@ -4938,45 +4980,45 @@ msgstr "添加用户"
msgid "Create user group"
msgstr "创建用户组"
#: users/templates/users/user_group_list.html:114
#: users/templates/users/user_group_list.html:115
msgid "This will delete the selected groups !!!"
msgstr "删除选择组"
#: users/templates/users/user_group_list.html:123
#: users/templates/users/user_group_list.html:124
msgid "UserGroups Deleted."
msgstr "用户组删除"
#: users/templates/users/user_group_list.html:124
#: users/templates/users/user_group_list.html:129
#: users/templates/users/user_group_list.html:125
#: users/templates/users/user_group_list.html:130
msgid "UserGroups Delete"
msgstr "用户组删除"
#: users/templates/users/user_group_list.html:128
#: users/templates/users/user_group_list.html:129
msgid "UserGroup Deleting failed."
msgstr "用户组删除失败"
#: users/templates/users/user_list.html:250
#: users/templates/users/user_list.html:251
msgid "This will delete the selected users !!!"
msgstr "删除选中用户 !!!"
#: users/templates/users/user_list.html:266
#: users/templates/users/user_list.html:267
msgid "User Deleted."
msgstr "已被删除"
#: users/templates/users/user_list.html:267
#: users/templates/users/user_list.html:271
#: users/templates/users/user_list.html:268
#: users/templates/users/user_list.html:272
msgid "User Delete"
msgstr "删除"
#: users/templates/users/user_list.html:270
#: users/templates/users/user_list.html:271
msgid "User Deleting failed."
msgstr "用户删除失败"
#: users/templates/users/user_list.html:323
#: users/templates/users/user_list.html:324
msgid "User is expired"
msgstr "用户已失效"
#: users/templates/users/user_list.html:326
#: users/templates/users/user_list.html:327
msgid "User is inactive"
msgstr "用户已禁用"
......@@ -5130,43 +5172,43 @@ msgstr "您好 %(name)s"
msgid ""
"\n"
" Hello %(name)s:\n"
" </br>\n"
" <br>\n"
" Please click the link below to reset your password, if not your request, "
"concern your account security\n"
" </br>\n"
" <br>\n"
" <a href=\"%(rest_password_url)s?token=%(rest_password_token)s\">Click "
"here reset password</a>\n"
" </br>\n"
" <br>\n"
" This link is valid for 1 hour. After it expires, <a href="
"\"%(forget_password_url)s?email=%(email)s\">request new one</a>\n"
"\n"
" </br>\n"
" <br>\n"
" ---\n"
"\n"
" </br>\n"
" <br>\n"
" <a href=\"%(login_url)s\">Login direct</a>\n"
"\n"
" </br>\n"
" <br>\n"
" "
msgstr ""
"\n"
" 您好 %(name)s:\n"
" </br>\n"
" <br>\n"
" 请点击下面链接重置密码, 如果不是您申请的,请关注账号安全\n"
" </br>\n"
" <br>\n"
" <a href=\"%(rest_password_url)s?token=%(rest_password_token)s\">请点击这"
"里设置密码 </a>\n"
" </br>\n"
" <br>\n"
" 这个链接有效期1小时, 超过时间您可以<a href=\"%(forget_password_url)s?"
"email=%(email)s\">重新申请</a>\n"
"\n"
" </br>\n"
" <br>\n"
" ---\n"
"\n"
" </br>\n"
" <br>\n"
" <a href=\"%(login_url)s\">直接登录</a>\n"
"\n"
" </br>\n"
" <br>\n"
" "
#: users/utils.py:117
......@@ -5178,77 +5220,103 @@ msgstr "安全通知"
msgid ""
"\n"
" Hello %(name)s:\n"
" </br>\n"
" <br>\n"
" Your password will expire in %(date_password_expired)s,\n"
" </br>\n"
" <br>\n"
" For your account security, please click on the link below to update your "
"password in time\n"
" </br>\n"
" <br>\n"
" <a href=\"%(update_password_url)s\">Click here update password</a>\n"
" </br>\n"
" <br>\n"
" If your password has expired, please click \n"
" <a href=\"%(forget_password_url)s?email=%(email)s\">Password expired</"
"a> \n"
" to apply for a password reset email.\n"
"\n"
" </br>\n"
" <br>\n"
" ---\n"
"\n"
" </br>\n"
" <br>\n"
" <a href=\"%(login_url)s\">Login direct</a>\n"
"\n"
" </br>\n"
" <br>\n"
" "
msgstr ""
"\n"
" 您好 %(name)s:\n"
" </br>\n"
" <br>\n"
" 您的密码会在 %(date_password_expired)s 过期,\n"
" </br>\n"
" <br>\n"
" 为了您的账号安全,请点击下面的链接及时更新密码\n"
" </br>\n"
" <br>\n"
" <a href=\"%(update_password_url)s\">请点击这里更新密码</a>\n"
" </br>\n"
" <br>\n"
" 如果您的密码已经过期,请点击 \n"
" <a href=\"%(forget_password_url)s?email=%(email)s\">密码过期</a> \n"
" 申请一份重置密码邮件。\n"
"\n"
" </br>\n"
" <br>\n"
" ---\n"
"\n"
" </br>\n"
" <br>\n"
" <a href=\"%(login_url)s\">直接登录</a>\n"
"\n"
" </br>\n"
" <br>\n"
" "
#: users/utils.py:155
msgid "Expiration notice"
msgstr "过期通知"
#: users/utils.py:157
#, python-format
msgid ""
"\n"
" Hello %(name)s:\n"
" <br>\n"
" Your account will expire in %(date_expired)s,\n"
" <br>\n"
" In order not to affect your normal work, please contact the "
"administrator for confirmation.\n"
" <br>\n"
" "
msgstr ""
"\n"
" 您好 %(name)s:\n"
" <br>\n"
" 您的账户会在 %(date_expired)s 过期,\n"
" <br>\n"
" 为了不影响您正常工作,请联系管理员确认。\n"
" <br>\n"
" "
#: users/utils.py:176
msgid "SSH Key Reset"
msgstr "重置ssh密钥"
#: users/utils.py:157
#: users/utils.py:178
#, python-format
msgid ""
"\n"
" Hello %(name)s:\n"
" </br>\n"
" <br>\n"
" Your ssh public key has been reset by site administrator.\n"
" Please login and reset your ssh public key.\n"
" </br>\n"
" <br>\n"
" <a href=\"%(login_url)s\">Login direct</a>\n"
"\n"
" </br>\n"
" <br>\n"
" "
msgstr ""
"\n"
" 你好 %(name)s:\n"
" </br>\n"
" <br>\n"
" 您的密钥已被管理员重置,\n"
" 请登录并重新设置您的密钥.\n"
" </br>\n"
" <br>\n"
" <a href=\"%(login_url)s\">Login direct</a>\n"
"\n"
" </br>\n"
" <br>\n"
" "
#: users/views/group.py:29
......@@ -5350,6 +5418,7 @@ msgid "* Please enter custom password"
msgstr "* 请输入自定义密码"
#: xpack/plugins/change_auth_plan/forms.py:64
#: xpack/plugins/cloud/serializers.py:73
msgid "* Please enter a valid crontab expression"
msgstr "* 请输入有效的 crontab 表达式"
......@@ -5357,6 +5426,10 @@ msgstr "* 请输入有效的 crontab 表达式"
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_create_update.html:60
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:81
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:17
#: xpack/plugins/cloud/forms.py:33 xpack/plugins/cloud/forms.py:81
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:41
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:72
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:16
msgid "Periodic perform"
msgstr "定时执行"
......@@ -5368,11 +5441,11 @@ msgstr ""
"提示:用户名为将要修改的资产上的用户的用户名。如果用户存在,则修改密码;如果"
"用户不存在,则创建用户。"
#: xpack/plugins/change_auth_plan/forms.py:125
#: xpack/plugins/change_auth_plan/forms.py:125 xpack/plugins/cloud/forms.py:84
msgid "Tips: (Units: hour)"
msgstr "提示:(单位: 时)"
#: xpack/plugins/change_auth_plan/forms.py:126
#: xpack/plugins/change_auth_plan/forms.py:126 xpack/plugins/cloud/forms.py:85
msgid ""
"eg: Every Sunday 03:05 run <5 3 * * 0> <br> Tips: Using 5 digits linux "
"crontab expressions <min hour day month week> (<a href='https://tool.lu/"
......@@ -5411,12 +5484,16 @@ msgstr "所有资产使用不同的随机密码"
#: xpack/plugins/change_auth_plan/models.py:76
#: xpack/plugins/change_auth_plan/models.py:145
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:100
#: xpack/plugins/cloud/models.py:165 xpack/plugins/cloud/models.py:219
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:91
msgid "Cycle perform"
msgstr "周期执行"
#: xpack/plugins/change_auth_plan/models.py:81
#: xpack/plugins/change_auth_plan/models.py:143
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:92
#: xpack/plugins/cloud/models.py:170 xpack/plugins/cloud/models.py:217
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:83
msgid "Regularly perform"
msgstr "定期执行"
......@@ -5476,10 +5553,12 @@ msgid "Length"
msgstr "长度"
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:84
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:75
msgid "Yes"
msgstr "是"
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:86
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:77
msgid "No"
msgstr "否"
......@@ -5488,7 +5567,7 @@ msgid "Run plan manually"
msgstr "手动执行计划"
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:179
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:102
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:103
msgid "Execute failed"
msgstr "执行失败"
......@@ -5497,6 +5576,7 @@ msgid "Execution list of plan"
msgstr "执行列表"
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_execution_list.html:104
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:89
msgid "Log"
msgstr "日志"
......@@ -5525,15 +5605,15 @@ msgstr "更新计划"
msgid "Plan execution task list"
msgstr "执行任务列表"
#: xpack/plugins/cloud/api.py:61 xpack/plugins/cloud/providers/base.py:84
#: xpack/plugins/cloud/api.py:61 xpack/plugins/cloud/providers/base.py:93
msgid "Account unavailable"
msgstr "账户无效"
#: xpack/plugins/cloud/forms.py:12
#: xpack/plugins/cloud/forms.py:14
msgid "Access Key ID"
msgstr ""
#: xpack/plugins/cloud/forms.py:13
#: xpack/plugins/cloud/forms.py:18
msgid "Access Key Secret"
msgstr ""
......@@ -5558,85 +5638,87 @@ msgid "Select admins"
msgstr "选择管理员"
#: xpack/plugins/cloud/meta.py:9 xpack/plugins/cloud/views.py:27
#: xpack/plugins/cloud/views.py:44 xpack/plugins/cloud/views.py:61
#: xpack/plugins/cloud/views.py:76 xpack/plugins/cloud/views.py:90
#: xpack/plugins/cloud/views.py:107 xpack/plugins/cloud/views.py:129
#: xpack/plugins/cloud/views.py:145 xpack/plugins/cloud/views.py:197
#: xpack/plugins/cloud/views.py:44 xpack/plugins/cloud/views.py:62
#: xpack/plugins/cloud/views.py:78 xpack/plugins/cloud/views.py:92
#: xpack/plugins/cloud/views.py:109 xpack/plugins/cloud/views.py:127
#: xpack/plugins/cloud/views.py:143 xpack/plugins/cloud/views.py:159
#: xpack/plugins/cloud/views.py:211
msgid "Cloud center"
msgstr "云管中心"
#: xpack/plugins/cloud/models.py:44
#: xpack/plugins/cloud/models.py:53
msgid "Available"
msgstr "有效"
#: xpack/plugins/cloud/models.py:45
#: xpack/plugins/cloud/models.py:54
msgid "Unavailable"
msgstr "无效"
#: xpack/plugins/cloud/models.py:50
#: xpack/plugins/cloud/models.py:63
#: xpack/plugins/cloud/templates/cloud/account_detail.html:54
#: xpack/plugins/cloud/templates/cloud/account_list.html:13
msgid "Provider"
msgstr "云服务商"
#: xpack/plugins/cloud/models.py:51
#: xpack/plugins/cloud/models.py:66
msgid "Access key id"
msgstr ""
#: xpack/plugins/cloud/models.py:52
#: xpack/plugins/cloud/models.py:70
msgid "Access key secret"
msgstr ""
#: xpack/plugins/cloud/models.py:60
#: xpack/plugins/cloud/models.py:88
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:30
msgid "Cloud account"
msgstr "云账号"
#: xpack/plugins/cloud/models.py:121
#: xpack/plugins/cloud/models.py:150
msgid "Regions"
msgstr "地域"
#: xpack/plugins/cloud/models.py:122
#: xpack/plugins/cloud/models.py:153
msgid "Instances"
msgstr "实例"
#: xpack/plugins/cloud/models.py:126
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:73
#: xpack/plugins/cloud/models.py:176
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:97
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:17
msgid "Date last sync"
msgstr "最后同步日期"
#: xpack/plugins/cloud/models.py:132 xpack/plugins/cloud/models.py:169
#: xpack/plugins/cloud/models.py:187 xpack/plugins/cloud/models.py:274
msgid "Sync instance task"
msgstr "同步实例任务"
#: xpack/plugins/cloud/models.py:165 xpack/plugins/cloud/models.py:179
#: xpack/plugins/cloud/models.py:268 xpack/plugins/cloud/models.py:291
msgid "Succeed"
msgstr "成功"
#: xpack/plugins/cloud/models.py:166
#: xpack/plugins/cloud/models.py:269
msgid "Partial succeed"
msgstr ""
#: xpack/plugins/cloud/models.py:173 xpack/plugins/cloud/models.py:189
#: xpack/plugins/cloud/models.py:284 xpack/plugins/cloud/models.py:316
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:71
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:66
msgid "Date sync"
msgstr "同步日期"
#: xpack/plugins/cloud/models.py:180
#: xpack/plugins/cloud/models.py:292
msgid "Exist"
msgstr "存在"
#: xpack/plugins/cloud/models.py:183
#: xpack/plugins/cloud/models.py:297
msgid "Sync task"
msgstr "同步任务"
#: xpack/plugins/cloud/models.py:184
#: xpack/plugins/cloud/models.py:301
msgid "Sync instance task history"
msgstr "同步实例任务历史"
#: xpack/plugins/cloud/models.py:185
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:89
#: xpack/plugins/cloud/models.py:304
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:117
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:61
msgid "Instance"
msgstr "实例"
......@@ -5658,7 +5740,7 @@ msgid "Qcloud"
msgstr "腾讯云"
#: xpack/plugins/cloud/templates/cloud/account_detail.html:20
#: xpack/plugins/cloud/views.py:77
#: xpack/plugins/cloud/views.py:79
msgid "Account detail"
msgstr "账户详情"
......@@ -5667,35 +5749,56 @@ msgstr "账户详情"
msgid "Create account"
msgstr "创建账户"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create.html:91
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:33
#, fuzzy
#| msgid "Instance"
msgid "Region & Instance"
msgstr "实例"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:37
#, fuzzy
#| msgid "Admin user"
msgid "Node & AdminUser"
msgstr "管理用户"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:66
msgid "Loading..."
msgstr "加载中..."
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create.html:106
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:67
msgid "Load failed"
msgstr "加载失败"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:20
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:25
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:21
#: xpack/plugins/cloud/views.py:130
#: xpack/plugins/cloud/views.py:144
msgid "Sync task detail"
msgstr "同步任务详情"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:23
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:28
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:24
#: xpack/plugins/cloud/views.py:146
#: xpack/plugins/cloud/views.py:160
msgid "Sync task history"
msgstr "同步历史列表"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:26
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:31
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_instance.html:27
#: xpack/plugins/cloud/views.py:198
#: xpack/plugins/cloud/views.py:212
msgid "Sync instance list"
msgstr "同步实例列表"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:138
msgid "Run task manually"
msgstr "手动执行任务"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_detail.html:181
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:99
msgid "Sync success"
msgstr "同步成功"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_history.html:65
msgid "Total count"
msgstr "总数"
......@@ -5724,22 +5827,24 @@ msgstr "执行次数"
msgid "Instance count"
msgstr "实例个数"
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_list.html:93
msgid "Sync success"
msgstr "同步成功"
#: xpack/plugins/cloud/views.py:62
# msgid "Sync success"
# msgstr "同步成功"
#: xpack/plugins/cloud/views.py:63
msgid "Update account"
msgstr "更新账户"
#: xpack/plugins/cloud/views.py:91
#: xpack/plugins/cloud/views.py:93
msgid "Sync instance task list"
msgstr "同步实例任务列表"
#: xpack/plugins/cloud/views.py:108
#: xpack/plugins/cloud/views.py:110
msgid "Create sync Instance task"
msgstr "创建同步实例任务"
#: xpack/plugins/cloud/views.py:128
msgid "Update sync Instance task"
msgstr "更新同步实例任务"
#: xpack/plugins/interface/forms.py:17 xpack/plugins/interface/models.py:15
msgid "Title of login page"
msgstr "登录页面标题"
......@@ -5967,29 +6072,16 @@ msgstr "密码匣子"
msgid "vault create"
msgstr "创建"
#~ msgid "Please select assets that need to be updated"
#~ msgstr "请选择需要更新的资产"
#~ msgid "The user {} password has expired, please update."
#~ msgstr "用户 {} 密码已经过期,请更新。"
#~ msgid "User not exist"
#~ msgstr "用户不存在"
# msgid "Disabled or expired"
# msgstr "禁用或失效"
#~ msgid "Password or SSH public key invalid"
#~ msgstr "密码或密钥不合法"
#~ msgid "Region & Instance"
#~ msgstr "地域 & 实例"
#~ msgid "Node & AdminUser"
#~ msgstr "节点 & 管理用户"
#~ msgid "Run task manually"
#~ msgstr "手动执行任务"
#~ msgid "Update sync Instance task"
#~ msgstr "更新同步实例任务"
#~ msgid "Please select assets that need to be updated"
#~ msgstr "请选择需要更新的资产"
#~ msgid "Interface"
#~ msgstr "界面"
......@@ -5997,9 +6089,6 @@ msgstr "创建"
#~ msgid "Orgs"
#~ msgstr "组织管理"
#~ msgid "Org"
#~ msgstr "组织"
#~ msgid "already exists"
#~ msgstr "已经存在"
......
......@@ -4,13 +4,14 @@ from rest_framework import viewsets
from django.db import transaction
from django.conf import settings
from orgs.mixins import RootOrgViewMixin
from common.permissions import IsValidUser
from ..models import CommandExecution
from ..serializers import CommandExecutionSerializer
from ..tasks import run_command_execution
class CommandExecutionViewSet(viewsets.ModelViewSet):
class CommandExecutionViewSet(RootOrgViewMixin, viewsets.ModelViewSet):
serializer_class = CommandExecutionSerializer
permission_classes = (IsValidUser,)
......
......@@ -422,7 +422,7 @@
'minsLeft' : '剩余 $1 分钟', // from v2.1.17 added 13.11.2016
'openAsEncoding' : '使用所选编码重新打开', // from v2.1.19 added 2.12.2016
'saveAsEncoding' : '使用所选编码保存', // from v2.1.19 added 2.12.2016
'selectFolder' : '选择目录(暂不支持)', // from v2.1.20 added 13.12.2016
'selectFolder' : '选择目录', // from v2.1.20 added 13.12.2016
'firstLetterSearch': '首字母搜索', // from v2.1.23 added 24.3.2017
'presets' : '预置', // from v2.1.25 added 26.5.2017
'tooManyToTrash' : '项目太多,不能移动到回收站.', // from v2.1.25 added 9.6.2017
......
{% load i18n %}
{% block user_expired_message %}
{% if request.user.is_expired %}
<div class="alert alert-danger help-message alert-dismissable">
{% blocktrans %}
Your account has expired, please contact the administrator.
{% endblocktrans %}
<button aria-hidden="true" data-dismiss="alert" class="close" type="button" style="outline: none;">×</button>
</div>
{% elif request.user.will_expired %}
<div class="alert alert-danger help-message alert-dismissable">
{% trans 'Your account will at' %} {{ request.user.date_expired }} {% trans 'expired. ' %}
<button aria-hidden="true" data-dismiss="alert" class="close" type="button" style="outline: none;">×</button>
</div>
{% endif %}
{% endblock %}
{% block password_expired_message %}
{% url 'users:user-password-update' as user_password_update_url %}
{% if request.user.password_has_expired %}
......
......@@ -27,6 +27,7 @@ class TerminalSerializer(serializers.ModelSerializer):
class SessionSerializer(BulkOrgResourceModelSerializer):
command_amount = serializers.IntegerField(read_only=True)
org_id = serializers.CharField(allow_blank=True)
class Meta:
model = Session
......
......@@ -403,6 +403,18 @@ class User(AuthMixin, TokenMixin, RoleMixin, MFAMixin, AbstractUser):
else:
return False
@property
def expired_remain_days(self):
date_remain = self.date_expired - timezone.now()
return date_remain.days
@property
def will_expired(self):
if 0 <= self.expired_remain_days < 5:
return True
else:
return False
@property
def is_valid(self):
if self.is_active and not self.is_expired:
......
# -*- coding: utf-8 -*-
#
import datetime
from django.utils import timezone
from django.conf import settings
from celery import shared_task
from ops.celery.utils import create_or_update_celery_periodic_tasks
from ops.celery.decorator import after_app_ready_start, register_as_period_task
from ops.celery.decorator import after_app_ready_start
from common.utils import get_logger
from .models import User
from .utils import send_password_expiration_reminder_mail
from .utils import (
send_password_expiration_reminder_mail, send_user_expiration_reminder_mail
)
logger = get_logger(__file__)
......@@ -43,4 +42,27 @@ def check_password_expired_periodic():
create_or_update_celery_periodic_tasks(tasks)
@shared_task
def check_user_expired():
users = User.objects.exclude(role=User.ROLE_APP)
for user in users:
if not user.is_valid:
continue
if not user.will_expired:
continue
send_user_expiration_reminder_mail(user)
@shared_task
@after_app_ready_start
def check_user_expired_periodic():
tasks = {
'check_user_expired_periodic': {
'task': check_user_expired.name,
'interval': None,
'crontab': '0 14 * * *',
'enabled': True,
}
}
create_or_update_celery_periodic_tasks(tasks)
......@@ -85,20 +85,20 @@ def send_reset_password_mail(user):
recipient_list = [user.email]
message = _("""
Hello %(name)s:
</br>
<br>
Please click the link below to reset your password, if not your request, concern your account security
</br>
<br>
<a href="%(rest_password_url)s?token=%(rest_password_token)s">Click here reset password</a>
</br>
<br>
This link is valid for 1 hour. After it expires, <a href="%(forget_password_url)s?email=%(email)s">request new one</a>
</br>
<br>
---
</br>
<br>
<a href="%(login_url)s">Login direct</a>
</br>
<br>
""") % {
'name': user.name,
'rest_password_url': reverse('users:reset-password', external=True),
......@@ -118,24 +118,24 @@ def send_password_expiration_reminder_mail(user):
recipient_list = [user.email]
message = _("""
Hello %(name)s:
</br>
<br>
Your password will expire in %(date_password_expired)s,
</br>
<br>
For your account security, please click on the link below to update your password in time
</br>
<br>
<a href="%(update_password_url)s">Click here update password</a>
</br>
<br>
If your password has expired, please click
<a href="%(forget_password_url)s?email=%(email)s">Password expired</a>
to apply for a password reset email.
</br>
<br>
---
</br>
<br>
<a href="%(login_url)s">Login direct</a>
</br>
<br>
""") % {
'name': user.name,
'date_password_expired': datetime.fromtimestamp(datetime.timestamp(
......@@ -151,18 +151,39 @@ def send_password_expiration_reminder_mail(user):
send_mail_async.delay(subject, message, recipient_list, html_message=message)
def send_user_expiration_reminder_mail(user):
subject = _('Expiration notice')
recipient_list = [user.email]
message = _("""
Hello %(name)s:
<br>
Your account will expire in %(date_expired)s,
<br>
In order not to affect your normal work, please contact the administrator for confirmation.
<br>
""") % {
'name': user.name,
'date_expired': datetime.fromtimestamp(datetime.timestamp(
user.date_expired)).strftime('%Y-%m-%d %H:%M'),
}
if settings.DEBUG:
logger.debug(message)
send_mail_async.delay(subject, message, recipient_list, html_message=message)
def send_reset_ssh_key_mail(user):
subject = _('SSH Key Reset')
recipient_list = [user.email]
message = _("""
Hello %(name)s:
</br>
<br>
Your ssh public key has been reset by site administrator.
Please login and reset your ssh public key.
</br>
<br>
<a href="%(login_url)s">Login direct</a>
</br>
<br>
""") % {
'name': user.name,
'login_url': reverse('authentication:login', external=True),
......@@ -264,6 +285,12 @@ def increase_login_failed_count(username, ip):
cache.set(key_limit, count, int(limit_time)*60)
def get_login_failed_count(username, ip):
key_limit = key_prefix_limit.format(username, ip)
count = cache.get(key_limit, 0)
return count
def clean_failed_count(username, ip):
key_limit = key_prefix_limit.format(username, ip)
key_block = key_prefix_block.format(username)
......@@ -272,9 +299,8 @@ def clean_failed_count(username, ip):
def is_block_login(username, ip):
key_limit = key_prefix_limit.format(username, ip)
count = get_login_failed_count(username, ip)
key_block = key_prefix_block.format(username)
count = cache.get(key_limit, 0)
limit_count = settings.SECURITY_LOGIN_LIMIT_COUNT
limit_time = settings.SECURITY_LOGIN_LIMIT_TIME
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment