Skip to content

Commit

Permalink
fix: fix the definition of saveMobile variable, fix the condition for…
Browse files Browse the repository at this point in the history
… sending the email for new email entere by user
  • Loading branch information
yaroslav-fedyshyn-nordwhale committed Dec 3, 2019
1 parent 3a60d26 commit 6319da9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/verification/verificationAPI.js
Expand Up @@ -129,7 +129,7 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
const mobile = body.user.mobile || user.otp.mobile

let userRec: UserRecord = _.defaults(body.user, user, { identifier: user.loggedInAs })
const savedMobile = userRec.mobile
const savedMobile = user.mobile

if (conf.allowDuplicateUserData === false && (await storage.isDupUserData({ mobile }))) {
return res.json({ ok: 0, error: 'Mobile already exists, please use a different one.' })
Expand Down Expand Up @@ -287,7 +287,7 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
if (conf.allowDuplicateUserData === false && (await storage.isDupUserData({ email }))) {
return res.json({ ok: 0, error: 'Email already exists, please use a different one' })
}
if (!user.mauticId || user.email !== body.email) {
if (!user.mauticId || savedEmail !== email) {
//first time create contact for user in mautic
const mauticContact = await Mautic.createContact(userRec)
userRec.mauticId = mauticContact.contact.fields.all.id
Expand Down

0 comments on commit 6319da9

Please sign in to comment.