Skip to content

Commit 630805b

Browse files
Display required fields automatically
1 parent ed61b4e commit 630805b

6 files changed

Lines changed: 92 additions & 34 deletions

File tree

html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Email.pm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ sub do_email_registration {
7979
my $note = 'email activation. Date of arrival: ' . time2str("%Y-%m-%d %H:%M:%S", time);
8080
$self->update_person_from_fields(notes => $note);
8181

82+
my @additional_fields;
83+
$info{additional_fields} = \@additional_fields;
8284
for my $key ( grep { !exists $auto_included{$_} } @{$self->required_fields // []}) {
83-
$info{$key} = $request_fields->{$key};
85+
my $value = $request_fields->{$key};
86+
push @additional_fields, { label => $key, value => $value };
87+
$info{$key} = $value;
8488
}
8589

8690
$info{'firstname'} = $self->request_fields->{firstname};

html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Sponsor.pm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,12 @@ sub do_sponsor_registration {
193193
foreach my $key (@auto_included) {
194194
$info{$key} = $request_fields->{$key};
195195
}
196-
196+
my @additional_fields;
197+
$info{additional_fields} = \@additional_fields;
197198
for my $key ( grep { !exists $auto_included{$_} } @{$self->required_fields // []}) {
198-
$info{$key} = $request_fields->{$key};
199+
my $value = $request_fields->{$key};
200+
push @additional_fields, { label => $key, value => $value };
201+
$info{$key} = $value;
199202
}
200203

201204
$info{'sponsor'} = $sponsor;

html/captive-portal/templates/emails/emails-guest_email_activation.html

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,40 @@
4141
display: block;
4242
margin: 13px 0;
4343
}
44+
4445
</style>
4546
<!--[if mso]>
46-
<noscript>
47-
<xml>
48-
<o:OfficeDocumentSettings>
49-
<o:AllowPNG/>
50-
<o:PixelsPerInch>96</o:PixelsPerInch>
51-
</o:OfficeDocumentSettings>
52-
</xml>
53-
</noscript>
54-
<![endif]-->
47+
<noscript>
48+
<xml>
49+
<o:OfficeDocumentSettings>
50+
<o:AllowPNG/>
51+
<o:PixelsPerInch>96</o:PixelsPerInch>
52+
</o:OfficeDocumentSettings>
53+
</xml>
54+
</noscript>
55+
<![endif]-->
5556
<!--[if lte mso 11]>
56-
<style type="text/css">
57-
.mj-outlook-group-fix { width:100% !important; }
58-
</style>
59-
<![endif]-->
57+
<style type="text/css">
58+
.mj-outlook-group-fix { width:100% !important; }
59+
</style>
60+
<![endif]-->
6061
<style type="text/css">
6162
@media only screen and (min-width:480px) {
6263
.mj-column-per-100 {
6364
width: 100% !important;
6465
max-width: 100%;
6566
}
6667
}
68+
6769
</style>
6870
<style media="screen and (min-width:480px)">
6971
.moz-text-html .mj-column-per-100 {
7072
width: 100% !important;
7173
max-width: 100%;
7274
}
75+
76+
</style>
77+
<style type="text/css">
7378
</style>
7479
<style type="text/css">
7580
</style>
@@ -175,6 +180,32 @@
175180
</table>
176181
</div>
177182
<!--[if mso | IE]></td></tr></table></td></tr><tr><td class="" width="600px" ><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:560px;" width="560" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
183+
<div style="margin:0px auto;max-width:560px;">
184+
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
185+
<tbody>
186+
<tr>
187+
<td style="direction:ltr;font-size:0px;padding:20px 0;padding-top:0;text-align:center;">
188+
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:560px;" ><![endif]-->
189+
<div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
190+
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
191+
<tbody>
192+
<tr>
193+
<td align="center" style="font-size:0px;padding:0;word-break:break-word;">
194+
<div style="font-family:Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:center;color:#333333;">[% FOREACH f IN additional_fields %] <p class="label" style="font-size: 10px; color: #333; text-transform: uppercase; margin-bottom: 0;">[% i18n(f.label) %]</p>
195+
<p class="value" style="font-weight: 600; margin-top: 5px;">[% f.value %]</p> [% END %]
196+
</div>
197+
</td>
198+
</tr>
199+
</tbody>
200+
</table>
201+
</div>
202+
<!--[if mso | IE]></td></tr></table><![endif]-->
203+
</td>
204+
</tr>
205+
</tbody>
206+
</table>
207+
</div>
208+
<!--[if mso | IE]></td></tr></table></td></tr><tr><td class="" width="600px" ><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:560px;" width="560" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
178209
<div style="margin:0px auto;max-width:560px;">
179210
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
180211
<tbody>
@@ -249,4 +280,4 @@
249280
</div>
250281
</body>
251282

252-
</html>
283+
</html>

html/captive-portal/templates/emails/emails-guest_email_activation.mjml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
</mj-text>
2525
</mj-column>
2626
</mj-section>
27+
<mj-section padding-top="0">
28+
<mj-column>
29+
<mj-text>
30+
[% FOREACH f IN additional_fields %]
31+
<p class="label">[% i18n(f.label) %]</p>
32+
<p class="value">[% f.value %]</p>
33+
[% END %]
34+
</mj-text>
35+
</mj-column>
36+
</mj-section>
2737
<mj-section padding-top="0">
2838
<mj-column>
2939
<mj-button href="[% activation_uri %]">[% i18n("Activate Access") %]</mj-button>
@@ -37,4 +47,4 @@
3747
</mj-wrapper>
3848
<mj-include path="_footer.mjml" />
3949
</mj-body>
40-
</mjml>
50+
</mjml>

html/captive-portal/templates/emails/emails-guest_sponsor_activation.html

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,23 @@
4141
display: block;
4242
margin: 13px 0;
4343
}
44+
4445
</style>
4546
<!--[if mso]>
46-
<noscript>
47-
<xml>
48-
<o:OfficeDocumentSettings>
49-
<o:AllowPNG/>
50-
<o:PixelsPerInch>96</o:PixelsPerInch>
51-
</o:OfficeDocumentSettings>
52-
</xml>
53-
</noscript>
54-
<![endif]-->
47+
<noscript>
48+
<xml>
49+
<o:OfficeDocumentSettings>
50+
<o:AllowPNG/>
51+
<o:PixelsPerInch>96</o:PixelsPerInch>
52+
</o:OfficeDocumentSettings>
53+
</xml>
54+
</noscript>
55+
<![endif]-->
5556
<!--[if lte mso 11]>
56-
<style type="text/css">
57-
.mj-outlook-group-fix { width:100% !important; }
58-
</style>
59-
<![endif]-->
57+
<style type="text/css">
58+
.mj-outlook-group-fix { width:100% !important; }
59+
</style>
60+
<![endif]-->
6061
<style type="text/css">
6162
@media only screen and (min-width:480px) {
6263
.mj-column-per-100 {
@@ -69,6 +70,7 @@
6970
max-width: 50%;
7071
}
7172
}
73+
7274
</style>
7375
<style media="screen and (min-width:480px)">
7476
.moz-text-html .mj-column-per-100 {
@@ -80,6 +82,9 @@
8082
width: 50% !important;
8183
max-width: 50%;
8284
}
85+
86+
</style>
87+
<style type="text/css">
8388
</style>
8489
<style type="text/css">
8590
</style>
@@ -205,7 +210,8 @@
205210
<p class="value" style="font-weight: 600; margin-top: 5px;">[% lastname %]</p> [% IF telephone %]<p class="label" style="font-size: 10px; color: #333; text-transform: uppercase; margin-bottom: 0;">[% i18n("Phone number") %]</p>
206211
<p class="value" style="font-weight: 600; margin-top: 5px;">[% telephone %]</p>[% END %] <p class="label" style="font-size: 10px; color: #333; text-transform: uppercase; margin-bottom: 0;">[% i18n("Email") %]</p>
207212
<p class="value" style="font-weight: 600; margin-top: 5px;">[% email %]</p> [% IF pid != email %]<p class="label" style="font-size: 10px; color: #333; text-transform: uppercase; margin-bottom: 0;">PID </p>
208-
<p class="value" style="font-weight: 600; margin-top: 5px;">[% pid %]</p>[% END %]
213+
<p class="value" style="font-weight: 600; margin-top: 5px;">[% pid %]</p>[% END %] [% FOREACH f IN additional_fields %] <p class="label" style="font-size: 10px; color: #333; text-transform: uppercase; margin-bottom: 0;">[% i18n(f.label) %]</p>
214+
<p class="value" style="font-weight: 600; margin-top: 5px;">[% f.value %]</p> [% END %]
209215
</div>
210216
</td>
211217
</tr>
@@ -290,4 +296,4 @@
290296
</div>
291297
</body>
292298

293-
</html>
299+
</html>

html/captive-portal/templates/emails/emails-guest_sponsor_activation.mjml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
<p class="value">[% email %]</p>
4040
[% IF pid != email %]<p class="label">PID
4141
<p class="value">[% pid %]</p>[% END %]
42+
[% FOREACH f IN additional_fields %]
43+
<p class="label">[% i18n(f.label) %]</p>
44+
<p class="value">[% f.value %]</p>
45+
[% END %]
4246
</mj-text>
4347
</mj-column>
4448
</mj-section>
@@ -58,4 +62,4 @@
5862
</mj-wrapper>
5963
<mj-include path="_footer.mjml" />
6064
</mj-body>
61-
</mjml>
65+
</mjml>

0 commit comments

Comments
 (0)