mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-06 01:40:52 +00:00
[Update] 修改settings配置 (#2067)
* [Update] 修改settings配置 * [Update] 修改settings * [Update] 修改密码校验规则前后端逻辑 * [Update] 修改用户config机制 * [Update] 修改配置 * [Update] 修改config example增加翻译
This commit is contained in:
@@ -688,41 +688,69 @@ function setUrlParam(url, name, value) {
|
||||
return url
|
||||
}
|
||||
|
||||
// Password check rules
|
||||
var rules_short_map_id = {
|
||||
'min': 'id_security_password_min_length',
|
||||
'upper': 'id_security_password_upper_case',
|
||||
'lower': 'id_security_password_lower_case',
|
||||
'number': 'id_security_password_number',
|
||||
'special': 'id_security_password_special_char'
|
||||
};
|
||||
|
||||
var rules_id_map_label = {
|
||||
'id_security_password_min_length': gettext('Password minimum length {N} bits'),
|
||||
'id_security_password_upper_case': gettext('Must contain capital letters'),
|
||||
'id_security_password_lower_case': gettext('Must contain lowercase letters'),
|
||||
'id_security_password_number': gettext('Must contain numeric characters'),
|
||||
'id_security_password_special_char': gettext('Must contain special characters')
|
||||
};
|
||||
|
||||
function getRuleLabel(rule){
|
||||
var label = '';
|
||||
if (rule.key === rules_short_map_id['min']){
|
||||
label = rules_id_map_label[rule.key].replace('{N}', rule.value)
|
||||
}
|
||||
else{
|
||||
label = rules_id_map_label[rule.key]
|
||||
}
|
||||
return label
|
||||
}
|
||||
|
||||
// 校验密码-改变规则颜色
|
||||
function checkPasswordRules(password, minLength) {
|
||||
if (wordMinLength(password, minLength)) {
|
||||
$('#rule_SECURITY_PASSWORD_MIN_LENGTH').css('color', 'green')
|
||||
$('#'+rules_short_map_id['min']).css('color', 'green')
|
||||
}
|
||||
else {
|
||||
$('#rule_SECURITY_PASSWORD_MIN_LENGTH').css('color', '#908a8a')
|
||||
$('#'+rules_short_map_id['min']).css('color', '#908a8a')
|
||||
}
|
||||
|
||||
if (wordUpperCase(password)) {
|
||||
$('#rule_SECURITY_PASSWORD_UPPER_CASE').css('color', 'green');
|
||||
$('#'+rules_short_map_id['upper']).css('color', 'green')
|
||||
}
|
||||
else {
|
||||
$('#rule_SECURITY_PASSWORD_UPPER_CASE').css('color', '#908a8a')
|
||||
$('#'+rules_short_map_id['upper']).css('color', '#908a8a')
|
||||
}
|
||||
|
||||
if (wordLowerCase(password)) {
|
||||
$('#rule_SECURITY_PASSWORD_LOWER_CASE').css('color', 'green')
|
||||
$('#'+rules_short_map_id['lower']).css('color', 'green')
|
||||
}
|
||||
else {
|
||||
$('#rule_SECURITY_PASSWORD_LOWER_CASE').css('color', '#908a8a')
|
||||
$('#'+rules_short_map_id['lower']).css('color', '#908a8a')
|
||||
}
|
||||
|
||||
if (wordNumber(password)) {
|
||||
$('#rule_SECURITY_PASSWORD_NUMBER').css('color', 'green')
|
||||
$('#'+rules_short_map_id['number']).css('color', 'green')
|
||||
}
|
||||
else {
|
||||
$('#rule_SECURITY_PASSWORD_NUMBER').css('color', '#908a8a')
|
||||
$('#'+rules_short_map_id['number']).css('color', '#908a8a')
|
||||
}
|
||||
|
||||
if (wordSpecialChar(password)) {
|
||||
$('#rule_SECURITY_PASSWORD_SPECIAL_CHAR').css('color', 'green')
|
||||
$('#'+rules_short_map_id['special']).css('color', 'green')
|
||||
}
|
||||
else {
|
||||
$('#rule_SECURITY_PASSWORD_SPECIAL_CHAR').css('color', '#908a8a')
|
||||
$('#'+rules_short_map_id['special']).css('color', '#908a8a')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,11 +777,12 @@ function wordSpecialChar(word) {
|
||||
return word.match(/[`,~,!,@,#,\$,%,\^,&,\*,\(,\),\-,_,=,\+,\{,\},\[,\],\|,\\,;,',:,",\,,\.,<,>,\/,\?]+/)
|
||||
}
|
||||
|
||||
|
||||
// 显示弹窗密码规则
|
||||
function popoverPasswordRules(password_check_rules, $el) {
|
||||
var message = "";
|
||||
jQuery.each(password_check_rules, function (idx, rules) {
|
||||
message += "<li id=" + rules.id + " style='list-style-type:none;'> <i class='fa fa-check-circle-o' style='margin-right:10px;' ></i>" + rules.label + "</li>";
|
||||
jQuery.each(password_check_rules, function (idx, rule) {
|
||||
message += "<li id=" + rule.key + " style='list-style-type:none;'> <i class='fa fa-check-circle-o' style='margin-right:10px;' ></i>" + getRuleLabel(rule) + "</li>";
|
||||
});
|
||||
//$('#id_password_rules').html(message);
|
||||
$el.html(message)
|
||||
|
Reference in New Issue
Block a user