[Web] Add moore password generator links

master
andryyy 2019-12-07 21:41:15 +01:00
parent 6ac40f304a
commit eb350d48c0
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
8 changed files with 34 additions and 29 deletions

View File

@ -125,15 +125,15 @@ if (isset($_SESSION['mailcow_cc_role'])) {
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?></label> <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" data-hibp="true" class="form-control" name="password" placeholder=""> <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label> <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" class="form-control" name="password2"> <input type="password" data-pwgen-field="true" class="form-control" name="password2">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -204,15 +204,15 @@ if (isset($_SESSION['mailcow_cc_role'])) {
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?></label> <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" data-hibp="true" class="form-control" name="password" placeholder=""> <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label> <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" class="form-control" name="password2"> <input type="password" data-pwgen-field="true" class="form-control" name="password2">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -680,15 +680,15 @@ if (isset($_SESSION['mailcow_cc_role'])) {
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?></label> <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" data-hibp="true" class="form-control" name="password" placeholder="<?=$lang['edit']['unchanged_if_empty'];?>"> <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="<?=$lang['edit']['unchanged_if_empty'];?>">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label> <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" class="form-control" name="password2"> <input type="password" data-pwgen-field="true" class="form-control" name="password2">
</div> </div>
</div> </div>
<div data-acl="<?=$_SESSION['acl']['extend_sender_acl'];?>" class="form-group"> <div data-acl="<?=$_SESSION['acl']['extend_sender_acl'];?>" class="form-group">
@ -1330,15 +1330,15 @@ if (isset($_SESSION['mailcow_cc_role'])) {
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?></label> <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" data-hibp="true" class="form-control" name="password" placeholder=""> <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label> <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" class="form-control" name="password2"> <input type="password" data-pwgen-field="true" class="form-control" name="password2">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -1387,5 +1387,6 @@ echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
</script> </script>
<?php <?php
$js_minifier->add('/web/js/site/edit.js'); $js_minifier->add('/web/js/site/edit.js');
$js_minifier->add('/web/js/site/pwgen.js');
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
?> ?>

View File

@ -12,6 +12,14 @@ $(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'}}); $.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 ) {
event.preventDefault();
$('[data-hibp]').trigger('input');
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);
});
// https://stackoverflow.com/questions/4399005/implementing-jquerys-shake-effect-with-animate // https://stackoverflow.com/questions/4399005/implementing-jquerys-shake-effect-with-animate
function shake(div,interval,distance,times) { function shake(div,interval,distance,times) {
if(typeof interval === 'undefined') { if(typeof interval === 'undefined') {

View File

@ -70,15 +70,6 @@ $(document).ready(function() {
auto_fill_quota($('#addSelectDomain').val()); auto_fill_quota($('#addSelectDomain').val());
}); });
auto_fill_quota($('#addSelectDomain').val()); auto_fill_quota($('#addSelectDomain').val());
$(".generate_password").click(function( event ) {
event.preventDefault();
$('[data-hibp]').trigger('input');
var random_passwd = GPW.pronounceable(8)
$(this).closest("form").find("input[name='password']").prop('type', 'text');
$(this).closest("form").find("input[name='password2']").prop('type', 'text');
$(this).closest("form").find("input[name='password']").val(random_passwd);
$(this).closest("form").find("input[name='password2']").val(random_passwd);
});
$(".goto_checkbox").click(function( event ) { $(".goto_checkbox").click(function( event ) {
$("form[data-id='add_alias'] .goto_checkbox").not(this).prop('checked', false); $("form[data-id='add_alias'] .goto_checkbox").not(this).prop('checked', false);
if ($("form[data-id='add_alias'] .goto_checkbox:checked").length > 0) { if ($("form[data-id='add_alias'] .goto_checkbox:checked").length > 0) {

View File

@ -216,6 +216,7 @@
"session_ua": "Formular-Token ungültig: User-Agent-Validierungsfehler" "session_ua": "Formular-Token ungültig: User-Agent-Validierungsfehler"
}, },
"user": { "user": {
"generate": "generieren",
"create_app_passwd": "Erstelle App Passwort", "create_app_passwd": "Erstelle App Passwort",
"app_passwds": "App Passwörter", "app_passwds": "App Passwörter",
"app_name": "App Name", "app_name": "App Name",
@ -666,6 +667,7 @@
"sieve_preset_2": "E-Mail eines bestimmten Absenders immer als gelesen markieren" "sieve_preset_2": "E-Mail eines bestimmten Absenders immer als gelesen markieren"
}, },
"edit": { "edit": {
"generate": "generieren",
"app_name": "App Name", "app_name": "App Name",
"app_passwd": "App Passwörter", "app_passwd": "App Passwörter",
"sogo_visible": "Alias in SOGo sichtbar", "sogo_visible": "Alias in SOGo sichtbar",

View File

@ -216,6 +216,7 @@
"ip_invalid": "Skipped invalid IP: %s" "ip_invalid": "Skipped invalid IP: %s"
}, },
"user": { "user": {
"generate": "generate",
"create_app_passwd": "Create app password", "create_app_passwd": "Create app password",
"app_passwds": "App passwords", "app_passwds": "App passwords",
"app_name": "App name", "app_name": "App name",
@ -665,6 +666,7 @@
"sieve_preset_2": "Always mark the e-mail of a specific sender as seen" "sieve_preset_2": "Always mark the e-mail of a specific sender as seen"
}, },
"edit": { "edit": {
"generate": "generate",
"app_name": "App name", "app_name": "App name",
"app_passwd": "App password", "app_passwd": "App password",
"sogo_visible": "Alias is visible in SOGo", "sogo_visible": "Alias is visible in SOGo",

View File

@ -50,13 +50,13 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password"><?=$lang['add']['password'];?> (<a href="#" class="generate_password"><?=$lang['add']['generate'];?></a>)</label> <label class="control-label col-sm-2" for="password"><?=$lang['add']['password'];?> (<a href="#" class="generate_password"><?=$lang['add']['generate'];?></a>)</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" data-hibp="true" class="form-control" name="password" placeholder="" required> <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="password2"><?=$lang['add']['password_repeat'];?></label> <label class="control-label col-sm-2" for="password2"><?=$lang['add']['password_repeat'];?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" class="form-control" name="password2" placeholder="" required> <input type="password" data-pwgen-field="true" class="form-control" name="password2" placeholder="" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -179,15 +179,15 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="app_passwd"><?=$lang['user']['password'];?></label> <label class="control-label col-sm-2" for="app_passwd"><?=$lang['user']['password'];?> (<a href="#" class="generate_password"><?=$lang['user']['generate'];?></a>)</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" data-hibp="true" class="form-control" name="app_passwd" autocomplete="off" required> <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="app_passwd" autocomplete="off" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="app_passwd2"><?=$lang['user']['password_repeat'];?></label> <label class="control-label col-sm-2" for="app_passwd2"><?=$lang['user']['password_repeat'];?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="password" class="form-control" name="app_passwd2" autocomplete="off" required> <input type="password" data-pwgen-field="true" class="form-control" name="app_passwd2" autocomplete="off" required>
<p class="help-block"><?=$lang['user']['new_password_description'];?></p> <p class="help-block"><?=$lang['user']['new_password_description'];?></p>
</div> </div>
</div> </div>
@ -226,15 +226,15 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" data-cached-form="false" data-id="pwchange" role="form" method="post" autocomplete="off"> <form class="form-horizontal" data-cached-form="false" data-id="pwchange" role="form" method="post" autocomplete="off">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-3" for="user_new_pass"><?=$lang['user']['new_password'];?></label> <label class="control-label col-sm-3" for="user_new_pass"><?=$lang['user']['new_password'];?> (<a href="#" class="generate_password"><?=$lang['user']['generate'];?></a>)</label>
<div class="col-sm-5"> <div class="col-sm-5">
<input type="password" data-hibp="true" class="form-control" name="user_new_pass" autocomplete="off" required> <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="user_new_pass" autocomplete="off" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-3" for="user_new_pass2"><?=$lang['user']['new_password_repeat'];?></label> <label class="control-label col-sm-3" for="user_new_pass2"><?=$lang['user']['new_password_repeat'];?></label>
<div class="col-sm-5"> <div class="col-sm-5">
<input type="password" class="form-control" name="user_new_pass2" autocomplete="off" required> <input type="password" data-pwgen-field="true" class="form-control" name="user_new_pass2" autocomplete="off" required>
<p class="help-block"><?=$lang['user']['new_password_description'];?></p> <p class="help-block"><?=$lang['user']['new_password_description'];?></p>
</div> </div>
</div> </div>

View File

@ -503,6 +503,7 @@ echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
</script> </script>
<?php <?php
$js_minifier->add('/web/js/site/user.js'); $js_minifier->add('/web/js/site/user.js');
$js_minifier->add('/web/js/site/pwgen.js');
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
} }
else { else {