-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
registration: add email notification capability
- Loading branch information
Showing
18 changed files
with
680 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
assets/portal/messaging/templates/email/en/registration_confirmation_body.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<html> | ||
<body> | ||
<p> | ||
Please confirm your registration by clicking this | ||
<a href="{{ .registration_url }}/ack/{{ .registration_id }}">link</a> | ||
and providing the registration code <b><code>{{ .registration_code }}</code></b> | ||
within the next 45 minutes. If you haven't done so, please re-register. | ||
</p> | ||
|
||
<p>The registation metadata follows:</p> | ||
<ul style="list-style-type: disc"> | ||
<li>Session ID: {{ .session_id }}</li> | ||
<li>Request ID: {{ .request_id }}</li> | ||
<li>Username: <code>{{ .username }}</code></li> | ||
<li>Email: <code>{{ .email }}</code></li> | ||
<li>IP Address: <code>{{ .src_ip }}</code></li> | ||
<li>Timestamp: {{ .timestamp }}</li> | ||
</ul> | ||
</body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
assets/portal/messaging/templates/email/en/registration_confirmation_subject.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Registration Confirmation Required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
printf "Generating default email messaging templates\n" | ||
|
||
TMPL_BODY_FILE=pkg/messaging/email_template_body.go | ||
TMPL_SUBJ_FILE=pkg/messaging/email_template_subject.go | ||
|
||
declare -a _LANG | ||
declare -a _TEMPLATES | ||
declare -a _NAMES | ||
_LANG[${#_LANG[@]}]="en" | ||
_TEMPLATES[${#_TEMPLATES[@]}]="registration_confirmation" | ||
|
||
printf "package messaging\n\n" > ${TMPL_BODY_FILE} | ||
printf "// EmailTemplateBody stores email body templates.\n" >> ${TMPL_BODY_FILE} | ||
printf "var EmailTemplateBody = map[string]string{\n" >> ${TMPL_BODY_FILE} | ||
|
||
printf "package messaging\n\n" > ${TMPL_SUBJ_FILE} | ||
printf "// EmailTemplateSubject stores email subject templates.\n" >> ${TMPL_SUBJ_FILE} | ||
printf "var EmailTemplateSubject = map[string]string{\n" >> ${TMPL_SUBJ_FILE} | ||
|
||
for LANG_ID in "${!_LANG[@]}"; do | ||
LANG_NAME=${_LANG[$LANG_ID]}; | ||
echo "Generating theme ${LANG_NAME}"; | ||
for TMPL_ID in "${!_TEMPLATES[@]}"; do | ||
TMPL_NAME=${_TEMPLATES[$TMPL_ID]}; | ||
echo "At template ${TMPL_NAME}"; | ||
|
||
# Email body | ||
printf "\"${LANG_NAME}/${TMPL_NAME}\": \`" >> ${TMPL_BODY_FILE} | ||
cat assets/portal/messaging/templates/email/${LANG_NAME}/${TMPL_NAME}_body.template >> ${TMPL_BODY_FILE} | ||
truncate -s -1 ${TMPL_BODY_FILE} | ||
printf "\`,\n" >> ${TMPL_BODY_FILE} | ||
|
||
# Email subject. | ||
printf "\"${LANG_NAME}/${TMPL_NAME}\": \`" >> ${TMPL_SUBJ_FILE} | ||
cat assets/portal/messaging/templates/email/${LANG_NAME}/${TMPL_NAME}_subject.template >> ${TMPL_SUBJ_FILE} | ||
truncate -s -1 ${TMPL_SUBJ_FILE} | ||
printf "\`,\n" >> ${TMPL_SUBJ_FILE} | ||
|
||
done | ||
done | ||
|
||
printf "}\n" >> ${TMPL_BODY_FILE} | ||
go fmt ${TMPL_BODY_FILE} | ||
versioned -addlicense -copyright="Paul Greenberg [email protected]" -year=2022 -filepath=${TMPL_BODY_FILE} | ||
|
||
printf "}\n" >> ${TMPL_SUBJ_FILE} | ||
go fmt ${TMPL_SUBJ_FILE} | ||
versioned -addlicense -copyright="Paul Greenberg [email protected]" -year=2022 -filepath=${TMPL_SUBJ_FILE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.