Skip to content

Commit 81366c0

Browse files
BrRenatAVVS
authored andcommitted
fix: stringify organization invite params in mail (#423)
1 parent d43ff3d commit 81366c0

3 files changed

Lines changed: 24 additions & 10 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@
5353
"ms-conf": "^5.0.2",
5454
"ms-flakeless": "^4.2.0",
5555
"ms-mailer-client": "^8.0.1",
56-
"ms-mailer-templates": "^1.11.1",
56+
"ms-mailer-templates": "^1.14.1",
5757
"ms-token": "^3.1.0",
5858
"otplib": "^11.0.1",
5959
"password-generator": "^2.2.0",
6060
"prom-client": "^11.5.3",
61+
"qs": "^6.8.0",
6162
"redis-filtered-sort": "^2.3.0",
6263
"request": "^2.88.0",
6364
"request-promise": "^4.2.4",

src/utils/challenges/email/generate.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const Promise = require('bluebird');
22
const render = require('ms-mailer-templates');
33
const generatePassword = require('password-generator');
4+
const { stringify } = require('qs');
45
const partial = require('lodash/partial');
56
const identity = require('lodash/identity');
67
const { InvalidOperationError } = require('common-errors');
@@ -41,12 +42,19 @@ function generate(email, type, ctx = {}, opts = {}, nodemailer = {}) {
4142
break;
4243
case USERS_ACTION_ORGANIZATION_INVITE:
4344
// generate secret
44-
context.qs = `?q=${context.token.secret}&organizationId=${ctx.organizationId}&username=${ctx.email}`;
45+
context.qs = `?${stringify({
46+
q: context.token.secret,
47+
organizationId: ctx.organizationId,
48+
username: ctx.email,
49+
})}`;
4550
context.link = generateLink(server, paths[type]);
4651
break;
4752
case USERS_ACTION_ORGANIZATION_REGISTER:
4853
// generate secret
49-
context.qs = `?password=${ctx.password}&login=${ctx.email}`;
54+
context.qs = `?${stringify({
55+
password: ctx.password,
56+
login: ctx.email,
57+
})}`;
5058
context.link = generateLink(server, paths[type]);
5159
break;
5260

yarn.lock

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,7 +3707,7 @@ growl@1.10.5:
37073707
resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
37083708
integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==
37093709

3710-
handlebars@^4.1.1, handlebars@^4.1.2, handlebars@^4.2.0:
3710+
handlebars@^4.1.2, handlebars@^4.2.0:
37113711
version "4.2.0"
37123712
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.2.0.tgz#57ce8d2175b9bbb3d8b3cf3e4217b1aec8ddcb2e"
37133713
integrity sha512-Kb4xn5Qh1cxAKvQnzNWZ512DhABzyFNmsaJf3OAkWNa4NkaqWcNI8Tao8Tasi0/F4JD9oyG0YxuFyvyR57d+Gw==
@@ -5579,14 +5579,14 @@ ms-mailer-client@^8.0.1:
55795579
dependencies:
55805580
lodash.merge "^4.6.1"
55815581

5582-
ms-mailer-templates@^1.11.1:
5583-
version "1.14.0"
5584-
resolved "https://registry.yarnpkg.com/ms-mailer-templates/-/ms-mailer-templates-1.14.0.tgz#582490a194f98f5a68ff38c3795210a34fa2326a"
5585-
integrity sha512-Rzto3y3+htJD1gVVbIqgD+fJGjZy9sK/xu23lVU9bs/N/bL8P68M67nXYI6tsgmeHdjnX4mokz+gqADiZFTtYA==
5582+
ms-mailer-templates@^1.14.1:
5583+
version "1.14.1"
5584+
resolved "https://registry.yarnpkg.com/ms-mailer-templates/-/ms-mailer-templates-1.14.1.tgz#20e1ad13e4902a657443b615dbfb7d9c239493be"
5585+
integrity sha512-i942Ihc5eTQaEVjYEcG0k9ZhA3uJGGuaTKTf0PoUnZPYc6zYpTrWiD7sf+CBJr/91QyKuT0/LI7G3S8F8u9wRg==
55865586
dependencies:
5587-
bluebird "^3.5.1"
5587+
bluebird "^3.5.5"
55885588
common-errors "^1.0.5"
5589-
handlebars "^4.1.1"
5589+
handlebars "^4.2.0"
55905590

55915591
ms-token@^3.1.0:
55925592
version "3.1.0"
@@ -6900,6 +6900,11 @@ qrcode-terminal@^0.12.0:
69006900
resolved "https://registry.yarnpkg.com/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz#bb5b699ef7f9f0505092a3748be4464fe71b5819"
69016901
integrity sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==
69026902

6903+
qs@^6.8.0:
6904+
version "6.8.0"
6905+
resolved "https://registry.yarnpkg.com/qs/-/qs-6.8.0.tgz#87b763f0d37ca54200334cd57bb2ef8f68a1d081"
6906+
integrity sha512-tPSkj8y92PfZVbinY1n84i1Qdx75lZjMQYx9WZhnkofyxzw2r7Ho39G3/aEvSUdebxpnnM4LZJCtvE/Aq3+s9w==
6907+
69036908
qs@~6.5.2:
69046909
version "6.5.2"
69056910
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"

0 commit comments

Comments
 (0)