mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2024-12-03 08:40:05 +08:00
[Web] use saved password policy for pwgen
This commit is contained in:
parent
606eaad8f7
commit
c928948b15
@ -12,14 +12,22 @@ $(document).ready(function() {
|
||||
$.notify({message: msg},{z_index: 20000, delay: auto_hide, type: type,placement: {from: "bottom",align: "right"},animate: {enter: 'animated fadeInUp',exit: 'animated fadeOutDown'}});
|
||||
}
|
||||
|
||||
$(".generate_password").click(function( event ) {
|
||||
$(".generate_password").click(async function( event ) {
|
||||
try {
|
||||
var password_policy = await window.fetch("/api/v1/get/passwordpolicy", { method:'GET', cache:'no-cache' });
|
||||
var password_policy = await password_policy.json();
|
||||
random_passwd_length = password_policy.length;
|
||||
} catch(err) {
|
||||
var random_passwd_length = 8;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
$('[data-hibp]').trigger('input');
|
||||
if (typeof($(this).closest("form").data('pwgen-length')) == "number") {
|
||||
var random_passwd = GPW.pronounceable($(this).closest("form").data('pwgen-length'))
|
||||
}
|
||||
else {
|
||||
var random_passwd = GPW.pronounceable(8)
|
||||
var random_passwd = GPW.pronounceable(random_passwd_length)
|
||||
}
|
||||
$(this).closest("form").find('[data-pwgen-field]').attr('type', 'text');
|
||||
$(this).closest("form").find('[data-pwgen-field]').val(random_passwd);
|
||||
|
@ -561,6 +561,15 @@ if (isset($_GET['query'])) {
|
||||
echo '{}';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$password_complexity_rules = password_complexity('get');
|
||||
if ($password_complexity_rules !== false) {
|
||||
process_get_return($password_complexity_rules);
|
||||
}
|
||||
else {
|
||||
echo '{}';
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user