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

Commit 8a93b44

Browse files
committed
Merge pull request #429 from appirio-tech/SUP-612-fix-inactive-users-can-register
inactive users shouldn't be allowed to register for challenges
2 parents 458f501 + 8695587 commit 8a93b44

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

actions/challengeRegistration.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,9 +869,12 @@ exports.registerChallenge = {
869869
if (error) {
870870
console.log("error: " + error);
871871
cb(error);
872-
} else {
873-
console.log("error11: " + error);
874-
api.dataAccess.executeQuery('check_challenge_exists', {challengeId: challengeId}, connection.dbConnectionMap, cb);
872+
} else {
873+
api.helper.checkUserActivated(connection.caller.handle, api, connection.dbConnectionMap, function (err, inactive) {
874+
var fail = err || inactive;
875+
if (fail) cb(fail);
876+
else api.dataAccess.executeQuery('check_challenge_exists', {challengeId: challengeId}, connection.dbConnectionMap, cb);
877+
});
875878
}
876879
}, function (result, cb) {
877880
if (result.length > 0) {

apiary.apib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9946,7 +9946,7 @@ Request
99469946
}
99479947

99489948
## Register for a software/studio challenge [/challenges/{challengeId}/register]
9949-
### Register for a software/studio challenge [GET]
9949+
### Register for a software/studio challenge [POST]
99509950

99519951
+ Parameters
99529952
+ challengeId (required, number, `1234567`) ... The challenge for which to register

0 commit comments

Comments
 (0)