diff --git a/application/Espo/Core/defaults/systemConfig.php b/application/Espo/Core/defaults/systemConfig.php index 406995ec9c..02cc074e8a 100644 --- a/application/Espo/Core/defaults/systemConfig.php +++ b/application/Espo/Core/defaults/systemConfig.php @@ -284,5 +284,6 @@ return [ 'requiredMariadbVersion' => '5.5.3', 'recommendedMariadbParams' => [], 'ldapPortalUserLdapAuth' => false, + 'passwordGenerateLength' => 10, 'aclStrictMode' => true, ]; diff --git a/application/Espo/Resources/i18n/en_US/Settings.json b/application/Espo/Resources/i18n/en_US/Settings.json index c8e9bde1fd..a71db82660 100644 --- a/application/Espo/Resources/i18n/en_US/Settings.json +++ b/application/Espo/Resources/i18n/en_US/Settings.json @@ -121,6 +121,7 @@ "useWebSocket": "Use WebSocket", "passwordRecoveryDisabled": "Disable password recovery", "passwordRecoveryForAdminDisabled": "Disable password recover for admin users", + "passwordGenerateLength": "Length of generated passwords", "auth2FA": "Enable 2-Factor Authentication", "auth2FAMethodList": "Available 2FA methods" }, diff --git a/application/Espo/Resources/layouts/Settings/authentication.json b/application/Espo/Resources/layouts/Settings/authentication.json index b6349db6e1..50ad762e5f 100644 --- a/application/Espo/Resources/layouts/Settings/authentication.json +++ b/application/Espo/Resources/layouts/Settings/authentication.json @@ -15,6 +15,7 @@ { "label": "Passwords", "rows": [ + [{"name": "passwordGenerateLength"}, false], [{"name": "passwordRecoveryDisabled"}, {"name": "passwordRecoveryForAdminDisabled"}] ] } diff --git a/application/Espo/Resources/metadata/entityDefs/Settings.json b/application/Espo/Resources/metadata/entityDefs/Settings.json index 9ae8647b6d..818fa4827c 100644 --- a/application/Espo/Resources/metadata/entityDefs/Settings.json +++ b/application/Espo/Resources/metadata/entityDefs/Settings.json @@ -166,6 +166,12 @@ "passwordRecoveryForAdminDisabled": { "type": "bool" }, + "passwordGenerateLength": { + "type": "int", + "min": 6, + "max": 150, + "required": true + }, "ldapHost": { "type": "varchar", "required": true diff --git a/application/Espo/Services/User.php b/application/Espo/Services/User.php index d64a1eadbb..582da3e59f 100644 --- a/application/Espo/Services/User.php +++ b/application/Espo/Services/User.php @@ -385,8 +385,8 @@ class User extends Record $letterCount = $this->getConfig()->get('passwordStrengthLetterCount'); $numberCount = $this->getConfig()->get('passwordStrengthNumberCount'); - $generateLength = $this->getConfig()->get('passwordGenerateLength', 8); - $generateLetterCount = $this->getConfig()->get('passwordGenerateLetterCount', 5); + $generateLength = $this->getConfig()->get('passwordGenerateLength', 10); + $generateLetterCount = $this->getConfig()->get('passwordGenerateLetterCount', 4); $generateNumberCount = $this->getConfig()->get('passwordGenerateNumberCount', 2); $length = is_null($length) ? $generateLength : $length; diff --git a/client/src/views/user/fields/generate-password.js b/client/src/views/user/fields/generate-password.js index cfb8871db0..b7669f4cc3 100644 --- a/client/src/views/user/fields/generate-password.js +++ b/client/src/views/user/fields/generate-password.js @@ -58,8 +58,8 @@ define('views/user/fields/generate-password', 'views/fields/base', function (Dep var letterCount = this.getConfig().get('passwordStrengthLetterCount'); var numberCount = this.getConfig().get('passwordStrengthNumberCount'); - var generateLength = this.getConfig().get('passwordGenerateLength') || 8; - var generateLetterCount = this.getConfig().get('passwordGenerateLetterCount') || 5; + var generateLength = this.getConfig().get('passwordGenerateLength') || 10; + var generateLetterCount = this.getConfig().get('passwordGenerateLetterCount') || 4; var generateNumberCount = this.getConfig().get('passwordGenerateNumberCount') || 2; length = (typeof length === 'undefined') ? generateLength : length;