Internal: Installer: Don't check requirements when generating example password

pull/4692/head
Angel Fernando Quiroz Campos 2 years ago
parent 37abba392b
commit be3bc90363
  1. 8
      public/main/inc/lib/api.lib.php
  2. 2
      public/main/install/index.php
  3. 2
      public/main/install/install.lib.php

@ -2211,12 +2211,8 @@ function api_format_course_array(Course $course = null)
/**
* Returns a difficult to guess password.
*
* @param int $length the length of the password
*
* @return string the generated password
*/
function api_generate_password($length = 8)
function api_generate_password(int $length = 8, $useRequirements = true): string
{
if ($length < 2) {
$length = 2;
@ -2230,7 +2226,7 @@ function api_generate_password($length = 8)
$minUpperCase = $length - $minLowerCase;
$password = '';
$passwordRequirements = api_get_setting('security.password_requirements', true);
$passwordRequirements = $useRequirements ? api_get_setting('security.password_requirements', true) : [];
$factory = new RandomLib\Factory();
$generator = $factory->getGenerator(new SecurityLib\Strength(SecurityLib\Strength::MEDIUM));

@ -224,7 +224,7 @@ if (!isset($_GET['running'])) {
}
$loginForm = 'admin';
$passForm = api_generate_password();
$passForm = api_generate_password(8, false);
$institutionUrlForm = 'https://chamilo.org';
$languageForm = api_get_language_isocode();
$checkEmailByHashSent = 0;

@ -1034,7 +1034,7 @@ function display_database_settings_form(
'dbUsernameForm' => $dbUsernameForm,
'dbPassForm' => $dbPassForm,
'dbNameForm' => $dbNameForm,
'examplePassword' => api_generate_password(),
'examplePassword' => api_generate_password(8, false),
'dbExists' => $databaseExists,
'dbConnError' => $databaseConnectionError,
'connParams' => $connectionParams,

Loading…
Cancel
Save