Skip to content

Commit

Permalink
Merge pull request TheThingsNetwork#6627 from TheThingsNetwork/backpo…
Browse files Browse the repository at this point in the history
…rt/3384-scrub-sensitive-info

Backport updated email templates
  • Loading branch information
KrishnaIyer authored Oct 11, 2023
2 parents 82c3a51 + 8e709f5 commit c8517d0
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 50 deletions.
4 changes: 2 additions & 2 deletions pkg/email/templates/invitation.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ Invitation
{{- end -}}

{{- define "preview" -}}
You have been invited {{- with .SenderIds }} by user {{ .IDString }} {{ end -}} to join {{ .Network.Name }}.
You have been invited to join {{ .Network.Name }}.
{{- end -}}

{{- define "body" -}}
<p>
Hello,
</p>
<p>
You have been invited {{- with .SenderIds }} by user <code>{{ .IDString }}</code> {{ end -}} to join <b>{{ .Network.Name }}</b>.
You have been invited to join <b>{{ .Network.Name }}</b>.
</p>
<p>
You can now visit <a href="{{ .Network.IdentityServerURL }}/register?invitation_token={{ .InvitationToken }}">this link</a> to register your user account.
Expand Down
2 changes: 1 addition & 1 deletion pkg/email/templates/invitation.txt.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Hello,

You have been invited {{- with .SenderIds }} by user {{ .IDString }} {{ end -}} to join {{ .Network.Name }}.
You have been invited to join {{ .Network.Name }}.

You can now go to {{ .Network.IdentityServerURL }}/register?invitation_token={{ .InvitationToken }} to register your user account.

Expand Down
4 changes: 2 additions & 2 deletions pkg/email/templates/testdata/invitation.body.golden.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</head>

<body style="word-spacing:normal;background-color:#E7E7E7;">
<div style="display:none;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">You have been invited by user foo-usr to join The Things Network.</div>
<div style="display:none;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">You have been invited to join The Things Network.</div>
<div style="background-color:#E7E7E7;">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#ffffff;background-color:#ffffff;width:100%;">
<tbody>
Expand Down Expand Up @@ -172,7 +172,7 @@
Hello,
</p>
<p>
You have been invited by user <code>foo-usr</code> to join <b>The Things Network</b>.
You have been invited to join <b>The Things Network</b>.
</p>
<p>
You can now visit <a href="https://eu1.cloud.thethings.network/oauth/register?invitation_token=TOKEN">this link</a> to register your user account.
Expand Down
2 changes: 1 addition & 1 deletion pkg/email/templates/testdata/invitation.body.golden.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Hello,

You have been invited by user foo-usr to join The Things Network.
You have been invited to join The Things Network.

You can now go to https://eu1.cloud.thethings.network/oauth/register?invitation_token=TOKEN to register your user account.

Expand Down
15 changes: 1 addition & 14 deletions pkg/email/templates/testdata/user_requested.body.golden.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,10 @@
Dear John Doe,
</p>
<p>
A new user just registered on <b>The Things Network</b>.
A new user with ID <code>foo-usr</code> just registered on <b>The Things Network</b>.
Since user registration requires admin approval, you need to approve this user before they can login.
</p>

<p>
<b>User ID:</b> <code>foo-usr</code>
</p>
<p>
<b>Name:</b> Foo User
</p>
<p>
<b>Description:</b> Foo User Description
</p>
<p>
<b>Email Address:</b> foo@example.com
</p>
<p>
You can review this user <a href="https://console.cloud.thethings.network/admin-panel/user-management/foo-usr">in the Console</a>.
</p></div>
</td>
Expand Down
7 changes: 1 addition & 6 deletions pkg/email/templates/testdata/user_requested.body.golden.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
Dear John Doe,

A new user just registered on The Things Network.
A new user with with ID foo-usr just registered on The Things Network.
Since user registration requires admin approval, you need to approve this user before they can login.

User ID: foo-usr
Name: Foo User
Description: Foo User Description
Email Address: foo@example.com

You can go to https://console.cloud.thethings.network/admin-panel/user-management/foo-usr to review this user in the Console.
2 changes: 1 addition & 1 deletion pkg/email/templates/testdata/validate.body.golden.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
Please confirm your email address for The Things Network.
</p>
<p>
Your email address "john.doe@example.com" will be used by user <code>foo-usr</code>.
Your email address will be linked to user <code>foo-usr</code>.
</p>
<p>
You can now visit <a href="https://eu1.cloud.thethings.network/oauth/validate?reference=ID&token=TOKEN">this link</a> to confirm your email address.
Expand Down
2 changes: 1 addition & 1 deletion pkg/email/templates/testdata/validate.body.golden.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Hello,

Please confirm your email address for The Things Network.

Your email address "john.doe@example.com" will be used by user "foo-usr".
Your email address will be linked to user "foo-usr".

You can go to https://eu1.cloud.thethings.network/oauth/validate?reference=ID&token=TOKEN to confirm your email address.
Alternatively, you can use the reference "ID" and confirmation token "TOKEN" directly.
Expand Down
15 changes: 1 addition & 14 deletions pkg/email/templates/user_requested.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,10 @@ Your review is required for a newly registered user.
Dear {{ .ReceiverName }},
</p>
<p>
A new user just registered on <b>{{ .Network.Name }}</b>.
A new user with ID <code>{{ .User.Ids.IDString }}</code> just registered on <b>{{ .Network.Name }}</b>.
Since user registration requires admin approval, you need to approve this user before they can login.
</p>

<p>
<b>User ID:</b> <code>{{ .User.Ids.IDString }}</code>
</p>
<p>
<b>Name:</b> {{ with .User.Name }}{{ . }}{{ else }}<i>none</i>{{ end }}
</p>
<p>
<b>Description:</b> {{ with .User.Description }}{{ . }}{{ else }}<i>none</i>{{ end }}
</p>
<p>
<b>Email Address:</b> {{ with .User.PrimaryEmailAddress }}{{ . }}{{ else }}<i>none</i>{{ end }}
</p>
<p>
You can review this user <a href="{{ .ConsoleURL }}">in the Console</a>.
</p>
{{- end -}}
7 changes: 1 addition & 6 deletions pkg/email/templates/user_requested.txt.tmpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
Dear {{ .ReceiverName }},

A new user just registered on {{ .Network.Name }}.
A new user with with ID {{ .User.Ids.IDString }} just registered on {{ .Network.Name }}.
Since user registration requires admin approval, you need to approve this user before they can login.

User ID: {{ .User.Ids.IDString }}
Name: {{ with .User.Name }}{{ . }}{{ else }}(none){{ end }}
Description: {{ with .User.Description }}{{ . }}{{ else }}(none){{ end }}
Email Address: {{ with .User.PrimaryEmailAddress }}{{ . }}{{ else }}(none){{ end }}

You can go to {{ .ConsoleURL }} to review this user in the Console.
2 changes: 1 addition & 1 deletion pkg/email/templates/validate.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Hello,
Please confirm your email address for {{ .Network.Name }}.
</p>
<p>
Your email address "{{ .Receiver.PrimaryEmailAddress }}" will be used by {{ .EntityType }} <code>{{ .IDString }}</code>.
Your email address will be linked to {{ .EntityType }} <code>{{ .IDString }}</code>.
</p>
<p>
You can now visit <a href="{{ .Network.IdentityServerURL }}/validate?reference={{ .ID }}&token={{ .Token }}">this link</a> to confirm your email address.
Expand Down
2 changes: 1 addition & 1 deletion pkg/email/templates/validate.txt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Hello,

Please confirm your email address for {{ .Network.Name }}.

Your email address "{{ .Receiver.PrimaryEmailAddress }}" will be used by {{ .EntityType }} "{{ .IDString }}".
Your email address will be linked to {{ .EntityType }} "{{ .IDString }}".

You can go to {{ .Network.IdentityServerURL }}/validate?reference={{ .ID }}&token={{ .Token }} to confirm your email address.
Alternatively, you can use the reference "{{ .ID }}" and confirmation token "{{ .Token }}" directly.
Expand Down

0 comments on commit c8517d0

Please sign in to comment.