Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Merge requests
!12
Signup functionality
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Signup functionality
sign-up
into
develop
Overview
0
Commits
19
Pipelines
0
Changes
36
Merged
Bogdan Cochior
requested to merge
sign-up
into
develop
6 years ago
Overview
0
Commits
19
Pipelines
0
Changes
36
Expand
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
f41847a0
19 commits,
6 years ago
36 files
+
1219
−
178
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
36
Search (e.g. *.vue) (Ctrl+P)
packages/component-email/src/helpers/Email.js
+
32
−
1
Options
@@ -3,6 +3,37 @@ const logger = require('@pubsweet/logger')
const
helpers
=
require
(
'
./helpers
'
)
module
.
exports
=
{
sendSignupEmail
:
async
({
dashboardUrl
,
res
,
email
,
UserModel
})
=>
{
let
user
try
{
user
=
await
UserModel
.
findByEmail
(
email
)
}
catch
(
e
)
{
const
notFoundError
=
await
helpers
.
handleNotFoundError
(
e
,
'
User
'
)
return
res
.
status
(
notFoundError
.
status
).
json
({
error
:
notFoundError
.
message
,
})
}
if
(
!
user
.
confirmationToken
)
{
return
res
.
status
(
400
)
.
json
({
error
:
'
User does not have a confirmation token.
'
})
}
try
{
await
mailService
.
sendSimpleEmail
({
toEmail
:
user
.
email
,
user
,
emailType
:
'
signup
'
,
dashboardUrl
,
meta
:
{
confirmationToken
:
user
.
confirmationToken
,
},
})
return
res
.
status
(
200
).
json
({})
}
catch
(
e
)
{
logger
.
error
(
e
)
return
res
.
status
(
500
).
json
({
error
:
'
Email could not be sent.
'
})
}
},
setupNewUserEmail
:
async
({
dashboardUrl
,
res
,
email
,
role
,
UserModel
})
=>
{
let
user
try
{
@@ -13,7 +44,7 @@ module.exports = {
error
:
notFoundError
.
message
,
})
}
if
(
user
.
passwordResetToken
===
undefined
)
{
if
(
!
user
.
passwordResetToken
)
{
return
res
.
status
(
400
)
.
json
({
error
:
'
User does not have a password reset token.
'
})