mirror of https://github.com/jumpserver/jumpserver
commit
5b6488e1b2
|
@ -76,7 +76,7 @@ $(document).ready(function () {
|
|||
'ip': "{% trans 'IP' %}",
|
||||
'protocols': "{% trans 'Protocols' %}",
|
||||
'platform': "{% trans 'Platform' %}",
|
||||
'system_users_join': "{% trans 'System user' %}",
|
||||
{#'system_users_join': "{% trans 'System user' %}",#}
|
||||
'domain': "{% trans 'Domain' %}",
|
||||
'comment': "{% trans 'Comment' %}",
|
||||
};
|
||||
|
|
|
@ -135,6 +135,19 @@ $(document).ready(function () {
|
|||
}
|
||||
};
|
||||
requestApi(data)
|
||||
}).on('click', '.btn-api-keydel', function (){
|
||||
var url = "{% url "api-auth:access-key-detail" pk=DEFAULT_PK %}";
|
||||
url = url.replace("{{ DEFAULT_PK }}", $(this).data("id")) ;
|
||||
var data = {
|
||||
url: url,
|
||||
method: "DELETE",
|
||||
success: function () {
|
||||
ak_table.ajax.reload();
|
||||
},
|
||||
success_message: "{% trans 'Delete success' %}"
|
||||
|
||||
};
|
||||
requestApi(data)
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
Binary file not shown.
|
@ -1671,7 +1671,7 @@ msgstr "定期测试系统用户可连接性: {}"
|
|||
|
||||
#: assets/tasks/utils.py:17
|
||||
msgid "Asset has been disabled, skipped: {}"
|
||||
msgstr "资产或许不支持ansible, 跳过: {}"
|
||||
msgstr "资产已经被禁用, 跳过: {}"
|
||||
|
||||
#: assets/tasks/utils.py:21
|
||||
msgid "Asset may not be support ansible, skipped: {}"
|
||||
|
|
|
@ -19,10 +19,13 @@ class AdHocExecutionSerializer(serializers.ModelSerializer):
|
|||
|
||||
@staticmethod
|
||||
def get_stat(obj):
|
||||
count_failed_hosts = len(obj.failed_hosts)
|
||||
count_success_hosts = len(obj.success_hosts)
|
||||
count_total = count_success_hosts + count_failed_hosts
|
||||
return {
|
||||
"total": obj.hosts_amount,
|
||||
"success": len(obj.summary.get("contacted", [])),
|
||||
"failed": len(obj.summary.get("dark", [])),
|
||||
"total": count_total,
|
||||
"success": count_success_hosts,
|
||||
"failed": count_failed_hosts
|
||||
}
|
||||
|
||||
def get_field_names(self, declared_fields, info):
|
||||
|
|
|
@ -5,3 +5,7 @@ from django.apps import AppConfig
|
|||
|
||||
class PermsConfig(AppConfig):
|
||||
name = 'perms'
|
||||
|
||||
def ready(self):
|
||||
super().ready()
|
||||
from . import signals_handler
|
||||
|
|
|
@ -218,7 +218,7 @@ function addGroups(groupsId) {
|
|||
}
|
||||
|
||||
function removeGroup(groupId) {
|
||||
var theUrl = "{% url 'api-perms:asset-permissions-user-groups-relation-list' %}?assetpermission={{ object.id }}";
|
||||
var theUrl = "{% url 'api-perms:asset-permissions-user-groups-relation-list' %}?assetpermission={{ object.id }}&usergroup=groupId";
|
||||
theUrl = theUrl.replace("groupId", groupId);
|
||||
var success = function(data) {
|
||||
location.reload();
|
||||
|
|
|
@ -218,7 +218,7 @@ function addGroups(groupsId) {
|
|||
}
|
||||
|
||||
function removeGroup(groupId) {
|
||||
var theUrl = "{% url 'api-perms:database-app-permissions-user-groups-relation-list' %}?databaseapppermission={{ object.id }}";
|
||||
var theUrl = "{% url 'api-perms:database-app-permissions-user-groups-relation-list' %}?databaseapppermission={{ object.id }}&usergroup=groupId";
|
||||
theUrl = theUrl.replace("groupId", groupId);
|
||||
var success = function(data) {
|
||||
location.reload();
|
||||
|
|
|
@ -179,9 +179,13 @@
|
|||
var body = {
|
||||
user_groups: groups
|
||||
};
|
||||
var success = function(data) {
|
||||
location.reload();
|
||||
};
|
||||
requestApi({
|
||||
url: the_url,
|
||||
body: JSON.stringify(body)
|
||||
body: JSON.stringify(body),
|
||||
success: success
|
||||
});
|
||||
}
|
||||
$(document).ready(function () {
|
||||
|
|
|
@ -83,26 +83,12 @@ class UserOtpEnableBindView(TemplateView, FormView):
|
|||
return super().get_context_data(**kwargs)
|
||||
|
||||
|
||||
class UserVerifyMFAView(FormView):
|
||||
class UserDisableMFAView(FormView):
|
||||
template_name = 'users/user_verify_mfa.html'
|
||||
form_class = forms.UserCheckOtpCodeForm
|
||||
success_url = reverse_lazy('users:user-otp-settings-success')
|
||||
permission_classes = [IsValidUser]
|
||||
|
||||
def form_valid(self, form):
|
||||
user = self.request.user
|
||||
otp_code = form.cleaned_data.get('otp_code')
|
||||
|
||||
valid = user.check_mfa(otp_code)
|
||||
if valid:
|
||||
return super().form_valid(form)
|
||||
else:
|
||||
error = _('MFA code invalid, or ntp sync server time')
|
||||
form.add_error('otp_code', error)
|
||||
return super().form_invalid(form)
|
||||
|
||||
|
||||
class UserDisableMFAView(UserVerifyMFAView):
|
||||
def form_valid(self, form):
|
||||
user = self.request.user
|
||||
otp_code = form.cleaned_data.get('otp_code')
|
||||
|
@ -118,8 +104,23 @@ class UserDisableMFAView(UserVerifyMFAView):
|
|||
return super().form_invalid(form)
|
||||
|
||||
|
||||
class UserOtpUpdateView(UserVerifyMFAView):
|
||||
class UserOtpUpdateView(FormView):
|
||||
template_name = 'users/user_verify_mfa.html'
|
||||
form_class = forms.UserCheckOtpCodeForm
|
||||
success_url = reverse_lazy('users:user-otp-enable-bind')
|
||||
permission_classes = [IsValidUser]
|
||||
|
||||
def form_valid(self, form):
|
||||
user = self.request.user
|
||||
otp_code = form.cleaned_data.get('otp_code')
|
||||
|
||||
valid = user.check_mfa(otp_code)
|
||||
if valid:
|
||||
return super().form_valid(form)
|
||||
else:
|
||||
error = _('MFA code invalid, or ntp sync server time')
|
||||
form.add_error('otp_code', error)
|
||||
return super().form_invalid(form)
|
||||
|
||||
|
||||
class UserOtpSettingsSuccessView(TemplateView):
|
||||
|
|
|
@ -67,7 +67,7 @@ class UserVerifyPasswordView(FormView):
|
|||
def form_valid(self, form):
|
||||
user = get_user_or_pre_auth_user(self.request)
|
||||
password = form.cleaned_data.get('password')
|
||||
user = authenticate(username=user.username, password=password)
|
||||
user = authenticate(request=self.request, username=user.username, password=password)
|
||||
if not user:
|
||||
form.add_error("password", _("Password invalid"))
|
||||
return self.form_invalid(form)
|
||||
|
|
Loading…
Reference in New Issue