Browse Source
Merge pull request #2886 from Budibase/email-user-name
Using the user's name in emails sent out where possible
gh-pages
Michael Drury
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
2 deletions
packages/worker/src/constants/templates/passwordRecovery.hbs
packages/worker/src/constants/templates/welcome.hbs
packages/worker/src/utilities/email.js
@ -6,7 +6,7 @@
<tr>
<tr>
<td class="content-cell">
<td class="content-cell">
<div class="f-fallback">
<div class="f-fallback">
<h1>Hi {{ email }} ,</h1>
<h1>Hi {{ # if name }} {{ name }} {{ else }} {{ email }} {{ / if }} ,</h1>
<p>You recently requested to reset your password for your {{ company }} account in your Budibase platform. Use the button below to reset it. <strong>This password reset is only valid for the next 24 hours.</strong></p>
<p>You recently requested to reset your password for your {{ company }} account in your Budibase platform. Use the button below to reset it. <strong>This password reset is only valid for the next 24 hours.</strong></p>
<!-- Action -->
<!-- Action -->
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
@ -6,7 +6,7 @@
<tr>
<tr>
<td class="content-cell">
<td class="content-cell">
<div class="f-fallback">
<div class="f-fallback">
<h1>Welcome, {{ email }} !</h1>
<h1>Welcome, {{ # if name }} {{ name }} {{ else }} {{ email }} {{ / if }} !</h1>
<p>Thanks for getting started with {{ company }} 's Budibase platform.</p>
<p>Thanks for getting started with {{ company }} 's Budibase platform.</p>
<p>For reference, here's how to login:</p>
<p>For reference, here's how to login:</p>
<table class="attributes" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<table class="attributes" width="100%" cellpadding="0" cellspacing="0" role="presentation">
@ -83,10 +83,15 @@ async function buildEmail(purpose, email, context, { user, contents } = {}) {
}
}
base = base . contents
base = base . contents
body = body . contents
body = body . contents
let name = user ? user . name : undefined
if ( user && ! name && user . firstName ) {
name = user . lastName ? ` ${ user . firstName } ${ user . lastName } ` : user . firstName
}
context = {
context = {
... context ,
... context ,
contents ,
contents ,
email ,
email ,
name ,
user : user || { } ,
user : user || { } ,
}
}