Skip to content

Commit 132a0f0

Browse files
author
sachin-maheshwari
authored
Merge pull request #285 from topcoder-platform/dev
Patch: for Auth0 onboarding rule
2 parents 7c3424c + df155e5 commit 132a0f0

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

web-assets/auth0/dev-tenant/rules/onboardingChecklist.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,30 @@ function (user, context, callback) {
1111
const _ = require('lodash');
1212
const moment = require('moment');
1313

14+
const isSocial = _.get(user, "identities[0].isSocial");
15+
const connection = _.get(user, "identities[0].connection");
16+
17+
console.log("rule:onboarding-checklist: isSocial/connection", isSocial + "/" + connection);
18+
console.log("rule:onboarding-checklist: WIPRO_SS_AZURE_AD_CONNECTION_NAME", configuration.WIPRO_SSO_AZURE_AD_CONNECTION_NAME);
19+
20+
if (_.includes([configuration.WIPRO_SSO_AZURE_AD_CONNECTION_NAME], connection)) {
21+
console.log("rule:onboarding-checklist:exiting due to user being an enterprise user.");
22+
return callback(null, user, context);
23+
}
24+
1425
let handle = _.get(user, "handle", null);
1526
const provider = _.get(user, "identities[0].provider", null);
16-
if (!handle && provider === "auth0") {
27+
if (isSocial || (!handle && provider === "auth0")) {
1728
handle = _.get(user, "nickname", null);
1829
}
1930

2031
console.log("rule:onboarding-checklist: fetch onboarding_checklist for email/handle: ", user.email, handle, provider);
2132

33+
// TODO: Properly fetch handle for social logins
34+
if (handle == null || isSocial) {
35+
return callback(null, user, context);
36+
}
37+
2238
const createdAt = _.get(user, "created_at", null);
2339
const thresholdDate = moment(configuration.PROFILE_CREATION_DATE_THRESHOLD, "YYYY-MM-DD");
2440

0 commit comments

Comments
 (0)