Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove forced error handling. Closes #9. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions lib/errors/badrequesterror.js

This file was deleted.

6 changes: 1 addition & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
/**
* Module dependencies.
*/
var Strategy = require('./strategy')
, BadRequestError = require('./errors/badrequesterror');

var Strategy = require('./strategy');

/**
* Expose constructors.
*/
exports.Strategy = Strategy;

exports.BadRequestError = BadRequestError;
7 changes: 1 addition & 6 deletions lib/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* Module dependencies.
*/
var passport = require('passport')
, util = require('util')
, BadRequestError = require('./errors/badrequesterror');
, util = require('util');


/**
Expand Down Expand Up @@ -84,10 +83,6 @@ Strategy.prototype.authenticate = function(req, options) {
var username = req.headers[this._usernameHeader] || lookup(req.body, this._usernameField) || lookup(req.query, this._usernameQuery);
var token = req.headers[this._tokenHeader] || lookup(req.body, this._tokenField) || lookup(req.query, this._tokenQuery);

if (!username || !token) {
return this.fail(new BadRequestError(options.badRequestMessage || 'Missing credentials'));
}

function verified(err, user, info) {
if (err) { return self.error(err); }
if (!user) { return self.fail(info); }
Expand Down