public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Web] use saved password policy for pwgen
c928948b
data/web/js/build/013-mailcow.js | 12 ++++++++++--
data/web/json_api.php | 9 +++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
Diff
diff --git a/data/web/js/build/013-mailcow.js b/data/web/js/build/013-mailcow.js
index c734c824..afe17bc6 100644
--- a/data/web/js/build/013-mailcow.js
+++ b/data/web/js/build/013-mailcow.js
@@ -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);
diff --git a/data/web/json_api.php b/data/web/json_api.php
index 1823e5a5..acaeaba9 100644
--- a/data/web/json_api.php
+++ b/data/web/json_api.php
@@ -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;