Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 45daf54

Browse files
author
ykohata
committed
Merge remote-tracking branch 'origin/technology-2014-12-18'
2 parents 66977b5 + e11ebe2 commit 45daf54

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

actions/terms.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ var getTermsOfUse = function (api, connection, dbConnectionMap, next) {
5858
return;
5959
}
6060

61+
sqlParams.userId = connection.caller.userId;
62+
6163
async.waterfall([
6264
function (cb) {
6365
// validate termsOfUseId parameter and set sql parameter

initializers/middleware.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,13 @@ exports.middleware = function (api, next) {
107107
return;
108108
}
109109
var split = decoded.sub.split("|");
110-
socialUserId = (split.pop() || "").trim();
111-
socialProvider = (split.pop() || "").trim();
110+
try {
111+
socialUserId = (split[split.length-1] || "").trim();
112+
socialProvider = (split[0] || "").trim();
113+
} catch (ignored) {
114+
cb(new IllegalArgumentError('Malformed Auth header. Could not parse token.sub!'));
115+
return;
116+
}
112117
if (!_.isDefined(socialUserId) || socialUserId.length === 0) {
113118
cb(new IllegalArgumentError('Malformed Auth header. No userId in token.sub!'));
114119
return;

queries/get_terms_of_use

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ SELECT tou.terms_of_use_id as terms_of_use_id,
44
touat.name as agreeability_type,
55
tou.terms_text as text,
66
touat.terms_of_use_agreeability_type_id as agreeability_type_id,
7-
toudtx.docusign_template_id as docusign_template_id
7+
toudtx.docusign_template_id as docusign_template_id,
8+
(utuox.user_id IS NOT NULL) as agreed
89
FROM terms_of_use tou
910
INNER JOIN terms_of_use_agreeability_type_lu touat ON touat.terms_of_use_agreeability_type_id = tou.terms_of_use_agreeability_type_id
1011
LEFT JOIN terms_of_use_docusign_template_xref toudtx ON toudtx.terms_of_use_id = tou.terms_of_use_id
12+
LEFT JOIN user_terms_of_use_xref utuox ON utuox.terms_of_use_id = tou.terms_of_use_id AND utuox.user_id = @userId@
1113
WHERE tou.terms_of_use_id = @termsOfUseId@

0 commit comments

Comments
 (0)