diff --git a/public/main/auth/inscription.php b/public/main/auth/inscription.php index 6ec7aa139d..c3edfadf90 100644 --- a/public/main/auth/inscription.php +++ b/public/main/auth/inscription.php @@ -679,6 +679,10 @@ if ('true' === api_get_setting('allow_terms_conditions')) { // Ofaj if (!api_is_anonymous() || 'course' !== api_get_setting('platform.load_term_conditions_section')) { $language = api_get_language_isocode(); + if (isset($termRegistered['user_id'])) { + $userInfo = api_get_user_info($termRegistered['user_id']); + $language = $userInfo['locale']; + } $language = api_get_language_id($language); $termPreview = LegalManager::get_last_condition($language); if (!$termPreview) { @@ -712,12 +716,12 @@ if ('true' === api_get_setting('allow_terms_conditions')) { 'checkbox', 'legal_accept', null, - get_lang('IHaveReadAndAgree') . ' ' . - get_lang('TermsAndConditions') . '' + get_lang('I have read and agree') . ' ' . + get_lang('Terms and conditions') . '' ); $form->addRule( 'legal_accept', - get_lang('ThisFieldIsRequired'), + get_lang('This field is required'), 'required' ); } else { @@ -731,6 +735,17 @@ if ('true' === api_get_setting('allow_terms_conditions')) { $form->addLabel($value['display_text'], $value['field_value']); } } + $form->addElement( + 'checkbox', + 'legal_accept', + null, + get_lang('I have read and agree') + ); + $form->addRule( + 'legal_accept', + get_lang('This field is required'), + 'required' + ); } } } diff --git a/src/CoreBundle/Controller/Admin/IndexBlocksController.php b/src/CoreBundle/Controller/Admin/IndexBlocksController.php index fcb25afc2a..e6b1306209 100644 --- a/src/CoreBundle/Controller/Admin/IndexBlocksController.php +++ b/src/CoreBundle/Controller/Admin/IndexBlocksController.php @@ -78,7 +78,7 @@ class IndexBlocksController extends BaseController } // Data protection - if ('false' === $this->settingsManager->getSetting('profile.disable_gdpr')) { + if ('true' !== $this->settingsManager->getSetting('profile.disable_gdpr')) { $json['data_privacy'] = [ 'editable' => false, 'items' => $this->getItemsPrivacy(), diff --git a/src/CoreBundle/Controller/SocialController.php b/src/CoreBundle/Controller/SocialController.php index 3e05b50c56..67245fc449 100644 --- a/src/CoreBundle/Controller/SocialController.php +++ b/src/CoreBundle/Controller/SocialController.php @@ -238,7 +238,8 @@ class SocialController extends AbstractController SettingsManager $settingsManager, UserRepository $userRepo, TranslatorInterface $translator, - MailerInterface $mailer + MailerInterface $mailer, + RequestStack $requestStack ): JsonResponse { $data = json_decode($request->getContent(), true); $userId = $data['userId'] ? (int) $data['userId'] : null; @@ -255,12 +256,12 @@ class SocialController extends AbstractController if ('delete_account' === $requestType) { $fieldToUpdate = 'request_for_delete_account'; $justificationFieldToUpdate = 'request_for_delete_account_justification'; - $emailSubject = 'Request for account removal'; + $emailSubject = $translator->trans('Request for account deletion'); $emailContent = sprintf($translator->trans('User %s asked for the deletion of his/her account, explaining that : ').$explanation, $user->getFullName()); } elseif ('delete_legal' === $requestType) { $fieldToUpdate = 'request_for_legal_agreement_consent_removal'; $justificationFieldToUpdate = 'request_for_legal_agreement_consent_removal_justification'; - $emailSubject = 'Request for consent withdrawal on legal terms'; + $emailSubject = $translator->trans('Request for consent withdrawal on legal terms'); $emailContent = sprintf($translator->trans('User %s asked for the removal of his/her consent to our legal terms, explaining that: ').$explanation, $user->getFullName()); } else { return $this->json(['success' => false, 'message' => 'Invalid action type']); @@ -270,17 +271,25 @@ class SocialController extends AbstractController UserManager::update_extra_field_value($userId, $fieldToUpdate, 1); UserManager::update_extra_field_value($userId, $justificationFieldToUpdate, $explanation); - $emailPlatform = $settingsManager->getSetting('admin.administrator_email'); - - $email = new Email(); - $email - ->from($user->getEmail()) - ->to($emailPlatform) - ->subject($emailSubject) - ->html($emailContent) - ; - - $mailer->send($email); + $request = $requestStack->getCurrentRequest(); + $baseUrl = $request->getSchemeAndHttpHost() . $request->getBasePath(); + $specificPath = '/main/admin/user_list_consent.php'; + $link = $baseUrl . $specificPath; + $emailContent .= $translator->trans('Go here : '). '' . $link . ''; + + $emailOfficer = $settingsManager->getSetting('profile.data_protection_officer_email'); + if (!empty($emailOfficer)) { + $email = new Email(); + $email + ->from($user->getEmail()) + ->to($emailOfficer) + ->subject($emailSubject) + ->html($emailContent) + ; + $mailer->send($email); + } else { + MessageManager::sendMessageToAllAdminUsers($user->getId(), $emailSubject, $emailContent); + } return $this->json([ 'success' => true, diff --git a/src/CoreBundle/Entity/Language.php b/src/CoreBundle/Entity/Language.php index 5daa127e14..a1b3f212f6 100644 --- a/src/CoreBundle/Entity/Language.php +++ b/src/CoreBundle/Entity/Language.php @@ -20,7 +20,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Platform languages. */ -#[ApiResource] +#[ApiResource(attributes: ["pagination_enabled" => false])] #[ApiFilter(BooleanFilter::class, properties: ['available'])] #[ApiFilter(OrderFilter::class, properties: ['english_name' => 'DESC'])] #[ORM\Table(name: 'language', options: ['row_format' => 'DYNAMIC'])]