chg: dev: add consent checkbox to user's registration - and fix the sharing pics #4
All checks were successful
Deploy to Production / deploy (push) Successful in 15s
All checks were successful
Deploy to Production / deploy (push) Successful in 15s
This commit is contained in:
@@ -78,6 +78,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, TotpTwo
|
||||
#[Column(length: 255, nullable: true)]
|
||||
private ?string $avatarPath = null;
|
||||
|
||||
#[Column(nullable: true)]
|
||||
private ?bool $consentGiven = null;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
@@ -243,4 +246,15 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, TotpTwo
|
||||
$this->backupCodes = $backupCodes;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isConsentGiven(): ?bool
|
||||
{
|
||||
return $this->consentGiven;
|
||||
}
|
||||
|
||||
public function setConsentGiven(?bool $consentGiven): self
|
||||
{
|
||||
$this->consentGiven = $consentGiven;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace App\Form;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
||||
@@ -19,6 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Email;
|
||||
use Symfony\Component\Validator\Constraints\IsTrue;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
@@ -68,6 +70,13 @@ class RegistrationFormType extends AbstractType
|
||||
),
|
||||
],
|
||||
])
|
||||
->add('consentGiven', CheckboxType::class, [
|
||||
'label' => 'I have read the Privacy and Data Processing Policy and I consent to the processing of my data.',
|
||||
'mapped' => true,
|
||||
'constraints' => [
|
||||
new IsTrue(message: 'You must agree to the privacy policy to create an account.'),
|
||||
],
|
||||
])
|
||||
->add('recaptcha', RecaptchaType::class);
|
||||
}
|
||||
|
||||
|
||||
42
src/Migrations/2026/04/Version20260416094849.php
Normal file
42
src/Migrations/2026/04/Version20260416094849.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
* Copyright (c) 2026 @ www.splendidbear.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Class Version20260416094849
|
||||
*
|
||||
* @package App\Migrations
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 16.
|
||||
*/
|
||||
final class Version20260416094849 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add consent property to user entity for GDPR compliance';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE app_user ADD consent_given BOOLEAN DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE app_user DROP consent_given');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user