Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
handle undefined user and bump version to 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
saltukalakus committed Jul 9, 2017
1 parent ef9afc2 commit ab49b30
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
18 changes: 10 additions & 8 deletions build/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,18 @@ module.exports =
console.log('Error getting user id', err);
cb(null, err);
} else {
// This should be a unique user because we filter
// This should be a unique single user because we filter
// with connection and user name. So getting the first
// item in the returned array.
if (body.length > 1) {
console.log("USER SHOULD BE UNIQUE!!!");
console.log(body);
if (body.length !== 1) {
cb(null, "Multiple user or no user for the requested name! Log Ignored");
} else if (typeof body[0].user_id === 'undefined' || !body[0].user_id) {
cb(null, "User Id missing! Log Ignored!");
} else {
console.log("USER ID =======");
console.log(body[0].user_id);
cb(body[0].user_id);
}
console.log("USER ID =======");
console.log(body[0].user_id);
cb(body[0].user_id);
}
});
}
Expand Down Expand Up @@ -347,7 +349,7 @@ module.exports =
module.exports = {
"title": "Auth0 Unblock Users",
"name": "auth0-unblock-users",
"version": "1.1.0",
"version": "1.2.0",
"author": "saltuk",
"description": "This extension will search for blocked users in the logs and unblock them",
"type": "cron",
Expand Down
18 changes: 10 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,18 @@ function getUserId(domain, token, connection, name, cb) {
console.log('Error getting user id', err);
cb(null, err);
} else {
// This should be a unique user because we filter
// This should be a unique single user because we filter
// with connection and user name. So getting the first
// item in the returned array.
if (body.length > 1) {
console.log("USER SHOULD BE UNIQUE!!!");
console.log(body);
}
console.log("USER ID =======");
console.log(body[0].user_id);
cb(body[0].user_id);
if (body.length !== 1) {
cb(null, "Multiple user or no user for the requested name! Log Ignored");
} else if (typeof body[0].user_id === 'undefined' || !body[0].user_id){
cb(null, "User Id missing! Log Ignored!");
} else {
console.log("USER ID =======");
console.log(body[0].user_id);
cb(body[0].user_id);
}
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth0-unblock-users",
"version": "1.1.0",
"version": "1.2.0",
"description": "This extension will search for blocked users in the logs and unblock them",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion webtask.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Auth0 Unblock Users",
"name": "auth0-unblock-users",
"version": "1.1.0",
"version": "1.2.0",
"author": "saltuk",
"description": "This extension will search for blocked users in the logs and unblock them",
"type": "cron",
Expand Down

0 comments on commit ab49b30

Please sign in to comment.