aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-20 17:00:58 +0200
committerChocobozzz <me@florianbigard.com>2020-07-20 17:00:58 +0200
commitec903c010ecc54ec2acad0bf2cf10e7fbf6a0fa2 (patch)
tree255a1f176f5f18a9205d2c7c8ce5f562f0e5ab31 /server/lib
parent677ea3c084508a1c3949b9f4b3da3c21bac8ff52 (diff)
parent2170f1db6ee40531f9d08b711d8b7b00254c0031 (diff)
downloadPeerTube-ec903c010ecc54ec2acad0bf2cf10e7fbf6a0fa2.tar.gz
PeerTube-ec903c010ecc54ec2acad0bf2cf10e7fbf6a0fa2.tar.zst
PeerTube-ec903c010ecc54ec2acad0bf2cf10e7fbf6a0fa2.zip
Merge branch 'release/2.3.0' into develop
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/emailer.ts6
-rw-r--r--server/lib/emails/password-reset/html.pug6
-rw-r--r--server/lib/user.ts3
3 files changed, 9 insertions, 6 deletions
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index d54eab966..48ba7421e 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -427,12 +427,13 @@ class Emailer {
427 return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) 427 return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
428 } 428 }
429 429
430 addPasswordResetEmailJob (to: string, resetPasswordUrl: string) { 430 addPasswordResetEmailJob (username: string, to: string, resetPasswordUrl: string) {
431 const emailPayload: EmailPayload = { 431 const emailPayload: EmailPayload = {
432 template: 'password-reset', 432 template: 'password-reset',
433 to: [ to ], 433 to: [ to ],
434 subject: 'Reset your account password', 434 subject: 'Reset your account password',
435 locals: { 435 locals: {
436 username,
436 resetPasswordUrl 437 resetPasswordUrl
437 } 438 }
438 } 439 }
@@ -454,12 +455,13 @@ class Emailer {
454 return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) 455 return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
455 } 456 }
456 457
457 addVerifyEmailJob (to: string, verifyEmailUrl: string) { 458 addVerifyEmailJob (username: string, to: string, verifyEmailUrl: string) {
458 const emailPayload: EmailPayload = { 459 const emailPayload: EmailPayload = {
459 template: 'verify-email', 460 template: 'verify-email',
460 to: [ to ], 461 to: [ to ],
461 subject: `Verify your email on ${WEBSERVER.HOST}`, 462 subject: `Verify your email on ${WEBSERVER.HOST}`,
462 locals: { 463 locals: {
464 username,
463 verifyEmailUrl 465 verifyEmailUrl
464 } 466 }
465 } 467 }
diff --git a/server/lib/emails/password-reset/html.pug b/server/lib/emails/password-reset/html.pug
index bb6a9d16b..ac33db5d7 100644
--- a/server/lib/emails/password-reset/html.pug
+++ b/server/lib/emails/password-reset/html.pug
@@ -5,8 +5,8 @@ block title
5 5
6block content 6block content
7 p. 7 p.
8 A reset password procedure for your account ${to} has been requested on #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}]. 8 A reset password procedure for your account #{username} has been requested on #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}].
9 Please follow #[a(href=resetPasswordUrl) this link] to reset it: #[a(href=resetPasswordUrl) #{resetPasswordUrl}] 9 Please follow #[a(href=resetPasswordUrl) this link] to reset it: #[a(href=resetPasswordUrl) #{resetPasswordUrl}]
10 (the link will expire within 1 hour) 10 (the link will expire within 1 hour)
11 p. 11 p.
12 If you are not the person who initiated this request, please ignore this email. \ No newline at end of file 12 If you are not the person who initiated this request, please ignore this email.
diff --git a/server/lib/user.ts b/server/lib/user.ts
index 642549879..6e7a738ee 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -111,8 +111,9 @@ async function sendVerifyUserEmail (user: MUser, isPendingEmail = false) {
111 if (isPendingEmail) url += '&isPendingEmail=true' 111 if (isPendingEmail) url += '&isPendingEmail=true'
112 112
113 const email = isPendingEmail ? user.pendingEmail : user.email 113 const email = isPendingEmail ? user.pendingEmail : user.email
114 const username = user.username
114 115
115 await Emailer.Instance.addVerifyEmailJob(email, url) 116 await Emailer.Instance.addVerifyEmailJob(username, email, url)
116} 117}
117 118
118// --------------------------------------------------------------------------- 119// ---------------------------------------------------------------------------