Skip to content

Commit 7fbad6a

Browse files
authored
Double-Opt-In Feature (#470)
1 parent 0fd8cd6 commit 7fbad6a

File tree

50 files changed

+1354
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1354
-125
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ Nothing to tell here, it's just [Symfony](https://symfony.com/doc/current/templa
5353
## Further Information
5454
- [Usage (Rendering Types, Configuration)](docs/0_Usage.md)
5555
- [Headless Mode](docs/1_HeadlessMode.md)
56-
- [SPAM Protection (Honeypot, reCAPTCHA)](docs/03_SpamProtection.md)
56+
- [SPAM Protection](docs/03_SpamProtection.md)
57+
- [Double-Opt-In Feature](docs/03_SpamProtection.md)
5758
- [Output Workflows](docs/OutputWorkflow/0_Usage.md)
5859
- [API Channel](docs/OutputWorkflow/09_ApiChannel.md)
5960
- [Email Channel](docs/OutputWorkflow/10_EmailChannel.md)

UPGRADE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Upgrade Notes
22

33
## 5.1.0
4+
- **[SECURITY FEATURE]** Double-Opt-In Feature, read more about it [here](/docs/.md)
5+
- If you're using a custom form theme, please include the `instructions` type (`{% use '@FormBuilder/form/theme/type/instructions.html.twig' %}`)
46
- **[SECURITY FEATURE]** Add [friendly captcha field](/docs/03_SpamProtection.md#friendly-captcha)
57
- **[SECURITY FEATURE]** Add [cloudflare turnstile](/docs/03_SpamProtection.md#cloudflare-turnstile)
68
- **[BUGFIX]** Use Pimcore AdminUserTranslator for Editable Dialog Box [#450](https://github.com/dachcom-digital/pimcore-formbuilder/issues/450)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FormBuilderBundle\Model\DoubleOptInSession:
2+
type: entity
3+
table: formbuilder_double_opt_in_session
4+
indexes:
5+
token_form:
6+
columns: [ token, form_definition, applied ]
7+
id:
8+
token:
9+
unique: true
10+
column: token
11+
type: uuid
12+
generator:
13+
strategy: CUSTOM
14+
customIdGenerator:
15+
class: Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator
16+
fields:
17+
email:
18+
column: email
19+
type: string
20+
nullable: false
21+
length: 190
22+
additionalData:
23+
column: additional_data
24+
type: array
25+
nullable: true
26+
dispatchLocation:
27+
column: dispatch_location
28+
type: text
29+
nullable: true
30+
applied:
31+
column: applied
32+
type: boolean
33+
options:
34+
default: 0
35+
creationDate:
36+
column: creationDate
37+
type: datetime
38+
nullable: false
39+
manyToOne:
40+
formDefinition:
41+
targetEntity: FormBuilderBundle\Model\FormDefinition
42+
orphanRemoval: true
43+
joinColumn:
44+
name: form_definition
45+
referencedColumnName: id
46+
onDelete: CASCADE
47+
uniqueConstraints:
48+
email_form_definition:
49+
columns: [email, form_definition, applied]

config/doctrine/model/FormDefinition.orm.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ FormBuilderBundle\Model\FormDefinition:
3333
modifiedBy:
3434
column: modifiedBy
3535
type: integer
36-
mailLayout:
37-
column: mailLayout
38-
type: object
39-
nullable: true
4036
configuration:
4137
column: configuration
4238
type: object

config/install/sql/install.sql

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CREATE TABLE IF NOT EXISTS `formbuilder_forms` (
66
`modificationDate` datetime NOT NULL,
77
`createdBy` int(11) NOT NULL,
88
`modifiedBy` int(11) NOT NULL,
9-
`mailLayout` longtext COMMENT '(DC2Type:object)',
109
`configuration` longtext COMMENT '(DC2Type:object)',
1110
`conditionalLogic` longtext COMMENT '(DC2Type:object)',
1211
`fields` longtext COMMENT '(DC2Type:form_builder_fields)',
@@ -37,4 +36,20 @@ CREATE TABLE IF NOT EXISTS `formbuilder_output_workflow_channel` (
3736
UNIQUE KEY `ow_name` (`output_workflow`,`name`),
3837
KEY `IDX_CEC462362C75DDDC` (`output_workflow`),
3938
CONSTRAINT `FK_CEC462362C75DDDC` FOREIGN KEY (`output_workflow`) REFERENCES `formbuilder_output_workflow` (`id`)
40-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
39+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
40+
41+
CREATE TABLE IF NOT EXISTS `formbuilder_double_opt_in_session` (
42+
`token` binary(16) NOT NULL COMMENT '(DC2Type:uuid)' PRIMARY KEY,
43+
`form_definition` int NULL,
44+
`email` varchar(190) NOT NULL,
45+
`additional_data` longtext NULL COMMENT '(DC2Type:array)',
46+
`dispatch_location` longtext NULL,
47+
`applied` tinyint(1) DEFAULT 0 NOT null,
48+
`creationDate` datetime NOT NULL,
49+
CONSTRAINT email_form_definition UNIQUE (email, form_definition, applied),
50+
CONSTRAINT FK_88815C4F61F7634C FOREIGN KEY (form_definition) REFERENCES formbuilder_forms (id) ON DELETE CASCADE
51+
);
52+
53+
create index IDX_88815C4F61F7634C on formbuilder_double_opt_in_session (form_definition);
54+
create index token_form on formbuilder_double_opt_in_session (token, form_definition, applied);
55+

config/install/translations/frontend.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@
3636
"form_builder.dynamic_multi_file.remove","Remove file","Datei entfernen"
3737
"form_builder.dynamic_multi_file.global.cannot_destroy_active_instance","This uploader is currently active or has some unprocessed files. in case there are some uploaded files, please remove them first.","Ein Uploader ist derzeit in dieser Sektion aktiv oder es wurden bereits Daten verarbeitet. Falls es bereits hochgeladene Dateien gibt, entfernen Sie diese bitte zuerst."
3838
"form_builder.form.container.repeater.min","%label%: You need to add at least %items% items.","%label%: Es werden mindestens %items% Einträge benötigt."
39-
"form_builder.form.container.repeater.max","%label%: Only %items% item(s) allowed.","%label%: Maximal %items% Einträge erlaubt."
39+
"form_builder.form.container.repeater.max","%label%: Only %items% item(s) allowed.","%label%: Maximal %items% Einträge erlaubt."
40+
"form_builder.form.double_opt_in.duplicate_session","Double-Opt-In Session for the given address has already been created.","Ein Zugang wurde für diese Adresse bereits erstellt."

config/services/double_opt_in.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
3+
_defaults:
4+
autowire: true
5+
autoconfigure: true
6+
public: true

config/services/forms/forms.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ services:
5252
tags:
5353
- { name: form.type }
5454

55+
FormBuilderBundle\Form\Type\InstructionsType:
56+
public: false
57+
tags:
58+
- { name: form.type }
59+
5560
FormBuilderBundle\Form\Type\SnippetType:
5661
autowire: true
5762
public: false
@@ -96,3 +101,11 @@ services:
96101
tags:
97102
- { name: form.type }
98103

104+
105+
#
106+
# Double-Opt-In
107+
108+
FormBuilderBundle\Form\Type\DoubleOptIn\DoubleOptInType:
109+
public: false
110+
tags:
111+
- { name: form.type }

config/services/manager.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ services:
1515
FormBuilderBundle\Manager\PresetManager: ~
1616

1717
# manager: template (form themes, type templates)
18-
FormBuilderBundle\Manager\TemplateManager: ~
18+
FormBuilderBundle\Manager\TemplateManager: ~
19+
20+
# manager: double-opt-in
21+
FormBuilderBundle\Manager\DoubleOptInManager: ~

config/services/repository.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ services:
99
FormBuilderBundle\Repository\FormDefinitionRepository: ~
1010

1111
FormBuilderBundle\Repository\OutputWorkflowRepositoryInterface: '@FormBuilderBundle\Repository\OutputWorkflowRepository'
12-
FormBuilderBundle\Repository\OutputWorkflowRepository: ~
12+
FormBuilderBundle\Repository\OutputWorkflowRepository: ~
13+
14+
FormBuilderBundle\Repository\DoubleOptInSessionRepositoryInterface: '@FormBuilderBundle\Repository\DoubleOptInSessionRepository'
15+
FormBuilderBundle\Repository\DoubleOptInSessionRepository: ~

0 commit comments

Comments
 (0)