diff --git a/app/config/profile.conf.dist.php b/app/config/profile.conf.dist.php index e66bcd6e60..8b84f1d249 100644 --- a/app/config/profile.conf.dist.php +++ b/app/config/profile.conf.dist.php @@ -10,32 +10,17 @@ // Autentication, password define('CHECK_PASS_EASY_TO_FIND', false); -$profileIsEditable = true; - -// User photos -define('PREFIX_IMAGE_FILENAME_WITH_UID', true); // If true, filename of images on server begin with uid of the user. -define('RESIZE_IMAGE_TO_THIS_HEIGTH', 180); -define('IMAGE_THUMBNAIL_WIDTH', 100); - -// Replacing user photos -define('KEEP_THE_NAME_WHEN_CHANGE_IMAGE', true); // true -> the new image have the name of previous. // false -> a new name is build for each upladed image. define('KEEP_THE_OLD_IMAGE_AFTER_CHANGE', true); // true -> if KEEP_THE_NAME_WHEN_CHANGE_IMAGE is true, the previous image is rename before. // false -> only the last image still on server. -// Official code -// Don't forget to change name of offical code in your organization -// See $langOfficialCode within the language file 'registration' -define('CONFVAL_ASK_FOR_OFFICIAL_CODE', true); // not used but name fixed -define('CONFVAL_CHECK_OFFICIAL_CODE', false); -/* if CONFVAL_CHECK_OFFICIAL_CODE is true, build here the -function personal_check_official_code($code, $valueToReturnIfOk, $valueToReturnIfBad) { - return $stateOfficialCode = true; -} -*/ - -// For stats -define('NB_LINE_OF_EVENTS', 15); +// Replacing user photos +define('KEEP_THE_NAME_WHEN_CHANGE_IMAGE', true); +// true -> the new image have the name of previous. +// false -> a new name is build for each upladed image. +define('KEEP_THE_OLD_IMAGE_AFTER_CHANGE', true); +// true -> if KEEP_THE_NAME_WHEN_CHANGE_IMAGE is true, the previous image is rename before. +// false -> only the last image still on server. diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index a058785a83..73dfeea20a 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -1723,8 +1723,7 @@ EOT; */ public function addPasswordRule($elementName, $groupName = '') { - // Constant defined in old config/profile.conf.php - if (CHECK_PASS_EASY_TO_FIND === true) { + if (api_get_setting('security.check_password') == 'true') { $message = get_lang('PassTooEasy').': '.api_generate_password(); if (!empty($groupName)) { diff --git a/main/inc/lib/usergroup.lib.php b/main/inc/lib/usergroup.lib.php index 318714ee0e..fd9bec8f8b 100755 --- a/main/inc/lib/usergroup.lib.php +++ b/main/inc/lib/usergroup.lib.php @@ -1392,7 +1392,7 @@ class UserGroup extends Model // Let us delete them. if (!empty($old_file)) { - if (KEEP_THE_OLD_IMAGE_AFTER_CHANGE) { + if (api_get_setting('platform.keep_old_images_after_delete') == 'true') { $prefix = 'saved_'.date('Y_m_d_H_i_s').'_'.uniqid('').'_'; @rename($path.'small_'.$old_file, $path.$prefix.'small_'.$old_file); @rename($path.'medium_'.$old_file, $path.$prefix.'medium_'.$old_file); @@ -1421,15 +1421,14 @@ class UserGroup extends Model } // This is the common name for the new photos. - if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) { + if (!empty($old_file)) { $old_extension = strtolower(substr(strrchr($old_file, '.'), 1)); $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; } else { $filename = api_replace_dangerous_char($filename); - if (PREFIX_IMAGE_FILENAME_WITH_UID) { - $filename = uniqid('').'_'.$filename; - } + $filename = uniqid('').'_'.$filename; + // We always prefix user photos with user ids, so on setting // api_get_setting('split_users_upload_directory') === 'true' // the correspondent directories to be found successfully. diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 8667d4daf6..bce2d82554 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -2027,7 +2027,7 @@ class UserManager // Let us delete them. if ($old_file != 'unknown.jpg') { - if (KEEP_THE_OLD_IMAGE_AFTER_CHANGE) { + if (api_get_setting('platform.keep_old_images_after_delete') == 'true') { $prefix = 'saved_'.date('Y_m_d_H_i_s').'_'.uniqid('').'_'; @rename($path.'small_'.$old_file, $path.$prefix.'small_'.$old_file); @rename($path.'medium_'.$old_file, $path.$prefix.'medium_'.$old_file); @@ -2056,15 +2056,13 @@ class UserManager } // This is the common name for the new photos. - if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && $old_file != 'unknown.jpg') { + if ($old_file != 'unknown.jpg') { $old_extension = strtolower(substr(strrchr($old_file, '.'), 1)); $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; } else { $filename = api_replace_dangerous_char($filename); - if (PREFIX_IMAGE_FILENAME_WITH_UID) { - $filename = uniqid('').'_'.$filename; - } + $filename = uniqid('').'_'.$filename; // We always prefix user photos with user ids, so on setting // api_get_setting('split_users_upload_directory') === 'true' // the correspondent directories to be found successfully. diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php index b35d7c0d38..32c305c714 100755 --- a/main/survey/fillsurvey.php +++ b/main/survey/fillsurvey.php @@ -446,18 +446,16 @@ if ($survey_data['form_fields'] != '' && if (isset($list['official_code']) && $list['official_code'] == 1) { // OFFICIAL CODE - if (CONFVAL_ASK_FOR_OFFICIAL_CODE) { - $form->addElement('text', 'official_code', get_lang('OfficialCode'), ['size' => 40]); - if (api_get_setting('profile', 'officialcode') !== 'true') { - $form->freeze('official_code'); - } - $form->applyFilter('official_code', 'stripslashes'); - $form->applyFilter('official_code', 'trim'); - if (api_get_setting('registration', 'officialcode') == 'true' && - api_get_setting('profile', 'officialcode') == 'true' - ) { - $form->addRule('official_code', get_lang('ThisFieldIsRequired'), 'required'); - } + $form->addElement('text', 'official_code', get_lang('OfficialCode'), ['size' => 40]); + if (api_get_setting('profile', 'officialcode') !== 'true') { + $form->freeze('official_code'); + } + $form->applyFilter('official_code', 'stripslashes'); + $form->applyFilter('official_code', 'trim'); + if (api_get_setting('registration', 'officialcode') == 'true' && + api_get_setting('profile', 'officialcode') == 'true' + ) { + $form->addRule('official_code', get_lang('ThisFieldIsRequired'), 'required'); } } diff --git a/src/CoreBundle/Settings/PlatformSettingsSchema.php b/src/CoreBundle/Settings/PlatformSettingsSchema.php index 1e0e3dcb94..1218f34570 100644 --- a/src/CoreBundle/Settings/PlatformSettingsSchema.php +++ b/src/CoreBundle/Settings/PlatformSettingsSchema.php @@ -46,6 +46,7 @@ class PlatformSettingsSchema extends AbstractSettingsSchema 'pdf_logo_header' => '', 'allow_my_files' => 'true', 'registered' => 'false', + 'keep_old_images_after_delete' => 'true', 'load_term_conditions_section' => 'login', //'server_type' => 'prod', replaced by value in .env 'show_full_skill_name_on_skill_wheel' => 'false', diff --git a/src/CoreBundle/Settings/SecuritySettingsSchema.php b/src/CoreBundle/Settings/SecuritySettingsSchema.php index 89cc2c00a9..88f3e6fbaf 100644 --- a/src/CoreBundle/Settings/SecuritySettingsSchema.php +++ b/src/CoreBundle/Settings/SecuritySettingsSchema.php @@ -31,6 +31,7 @@ class SecuritySettingsSchema extends AbstractSettingsSchema 'captcha_number_mistakes_to_block_account' => '', 'captcha_time_to_block' => '', 'prevent_multiple_simultaneous_login' => 'false', + 'check_password' => 'false' ] ); $allowedTypes = [ @@ -57,6 +58,7 @@ class SecuritySettingsSchema extends AbstractSettingsSchema ->add('captcha_number_mistakes_to_block_account', 'text') ->add('captcha_time_to_block', 'text') ->add('prevent_multiple_simultaneous_login', YesNoType::class) + ->add('check_password', YesNoType::class) ; } diff --git a/tests/behat/README.md b/tests/behat/README.md index f59cb71e25..bf46e520a5 100644 --- a/tests/behat/README.md +++ b/tests/behat/README.md @@ -34,7 +34,6 @@ cd /tmp && wget https://chromedriver.storage.googleapis.com/2.35/chromedriver_li - Social network tool must be available (allow_social_tool = true) - Student can register to the system (allow_registration = yes) - Teacher can register to the system (allow_registration_as_teacher = yes) -- The CHECK_PASS_EASY_TO_FIND in app/config/profile.conf.php must be set to false ### Run tests