Skip to content

Commit cb5a44b

Browse files
author
sachin-maheshwari
authored
Merge pull request #311 from topcoder-platform/dev
Plat-960
2 parents e4ab476 + 870b7fa commit cb5a44b

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function (user, context, callback) {
1919
handle = _.get(user, "nickname", null);
2020
}
2121
console.log("Fetch roles for email/handle: ", user.email, handle, provider);
22-
2322
global.AUTH0_CLAIM_NAMESPACE = "https://" + configuration.DOMAIN + "/";
2423
try {
2524
request.post({
@@ -47,6 +46,12 @@ function (user, context, callback) {
4746
// TEMP
4847
let tcsso = res.result.content.regSource || '';
4948

49+
// block wipro/topgear contractor user
50+
const topgearBlockMessage = 'Topgear can be accessed only by Wipro Employees. If you are a Wipro employee and not able to access, drop an email to <a href="mailto:[email protected]"> [email protected] </a> with the error message.Back to application ';
51+
if (roles.indexOf(configuration.TOPGEAR_CONTRACTOR_ROLE) > -1) {
52+
return callback(topgearBlockMessage, user, context);
53+
}
54+
5055
context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'roles'] = roles;
5156
context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'userId'] = userId;
5257
context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'handle'] = handle;

web-assets/auth0/prod-tenant/rules/custom.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ function (user, context, callback) {
4242
// TEMP
4343
let tcsso = res.result.content.regSource || '';
4444

45+
// block wipro/topgear contractor user
46+
const topgearBlockMessage = 'Topgear can be accessed only by Wipro Employees. If you are a Wipro employee and not able to access, drop an email to <a href="mailto:[email protected]"> [email protected] </a> with the error message.Back to application ';
47+
if (roles.indexOf(configuration.TOPGEAR_CONTRACTOR_ROLE) > -1) {
48+
return callback(topgearBlockMessage, user, context);
49+
}
50+
4551
context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'roles'] = roles;
4652
context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'userId'] = userId;
4753
context.idToken[global.AUTH0_CLAIM_NAMESPACE + 'handle'] = handle;

web-assets/js/setupAuth0WithRedirect.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,9 @@ const authSetup = function () {
634634
function showLoginError(message, linkUrl) {
635635
try {
636636
document.getElementById("page-title-heading").innerText = "Alert";
637-
var messageElement = document.createElement("span");
638-
messageElement.appendChild(document.createTextNode(message));
639-
document.getElementById("loading_message_p").innerHTML = messageElement.innerText + " <a href=" + linkUrl + ">click here</a>";
637+
var messageElement = document.createElement("textarea");
638+
messageElement.innerHTML = message;
639+
document.getElementById("loading_message_p").innerHTML = messageElement.value + " <a href=" + linkUrl + ">click here</a>";
640640
} catch (err) {
641641
logger("Error in changing loading message: ", err.message)
642642
}

0 commit comments

Comments
 (0)