Skip to content

Commit

Permalink
Update lib/cas.js
Browse files Browse the repository at this point in the history
- Due to the \r character, sections must be updated to [1] and [2]
- Use both http and https protocol.
  • Loading branch information
revskill10 committed Jan 8, 2013
1 parent 022db85 commit 84e4151
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/cas.js
Expand Up @@ -11,7 +11,6 @@

var http = require('http');
var url = require('url');

/**
* Initialize CAS with the given `options`.
*
Expand Down Expand Up @@ -80,13 +79,13 @@ CAS.prototype.validate = function(ticket, callback) {
});

res.on('end', function() {
var sections = response.split('\n');
var sections = response.split('\n');
if (sections.length >= 1) {
if (sections[0] == 'no') {
if (sections[1] == 'no') {
callback(undefined, false);
return;
} else if (sections[0] == 'yes' && sections.length >= 2) {
callback(undefined, true, sections[1]);
} else if (sections[1] == 'yes' && sections.length >= 2) {
callback(undefined, true, sections[2]);
return;
}
}
Expand All @@ -95,4 +94,4 @@ CAS.prototype.validate = function(ticket, callback) {
callback({message: 'Bad response format.'});
});
});
};
};

0 comments on commit 84e4151

Please sign in to comment.