[Web] Generate longer passwords for app passwords

master
andryyy 2019-12-07 21:55:37 +01:00
parent eb350d48c0
commit 0c8d9ff154
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 7 additions and 2 deletions

View File

@ -15,7 +15,12 @@ $(document).ready(function() {
$(".generate_password").click(function( event ) {
event.preventDefault();
$('[data-hibp]').trigger('input');
var random_passwd = GPW.pronounceable(8)
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)
}
$(this).closest("form").find('[data-pwgen-field]').attr('type', 'text');
$(this).closest("form").find('[data-pwgen-field]').val(random_passwd);
});

View File

@ -171,7 +171,7 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
<h3 class="modal-title"><?=$lang['add']['app_password'];?></h3>
</div>
<div class="modal-body">
<form class="form-horizontal" data-cached-form="true" role="form" data-id="add_apppasswd">
<form class="form-horizontal" data-cached-form="true" role="form" data-pwgen-length="32" data-id="add_apppasswd">
<div class="form-group">
<label class="control-label col-sm-2" for="app_name"><?=$lang['add']['app_name'];?></label>
<div class="col-sm-10">