Code Monkey home page Code Monkey logo

compound-passport's People

Contributors

1602 avatar amirotin avatar chok avatar cholalabs avatar dsiu avatar ierceg avatar mhupman avatar peter-story avatar romb avatar songlipeng2003 avatar tysoncadenhead avatar wxmerkt avatar yawetse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

compound-passport's Issues

errors in local.js

You lost three return done(err, user) in the local.js:

exports.callback = function (email, password, done) {
.....................................
var len = exports.User.verifyPassword.length;
if (len === 2) {
if (!exports.User.verifyPassword(password, user.encrypt_password)) {
"return" done(err, false);
} else {
"return" done(err, user);
}
} else if (len === 3) {
exports.User.verifyPassword(password, user.password, function(err, isMatch) {
"return" done(err, !err && isMatch ? user : false);

        });
    }
    return done(err, false);
});

};

railway-passport breaks route for PUT (when updating Model)

I realized that, for some reason, your code breaks HTTP PUT, so you will receive a "Undefined action" when updating a Model:

Loading railway-passport before:

// init passport
rwps.init();

// hook up user model
process.nextTick(function () {
    rwpass.loadUser(User);
});

app.use(app.router);

You should load railway-passport after loading the routes.

app.use(app.router);

// init passport
rwps.init();

// hook up user model
process.nextTick(function () {
    rwpass.loadUser(User);
});

Nice job btw, I like your railway framework.

Local Strategy doesnt work asynchronously because of no callback

I ran into an issue when writing my local authentication with bcrypt.

strategies/local.js expects the following:

if (!exports.User.verifyPassword(password, user.password)) {

However, User.verifyPassword is always defined..

I propose to change the local.js strategy to the following.

        exports.User.verifyPassword(password, user.password, function(err, isMatch) {
          if(err) {
            console.log("Error!");
            throw err;
          }
          else {
            if(isMatch) {
              done(err,user);
            }
            else {
              done(err,false);
            }
          }
        });
    });

That way verifyPassword can execute asynchronously and return user/false along with errors.

Your verifyPassword method in your users model would look like this:

  User.verifyPassword = function (password, hash, callback) {
    bcrypt.compare(password, hash, function(err, isMatch){
      callback(err, isMatch);
    });
  }

I'd be happy to submit a pull request for this. Unless anyone knows of a better way to accomplish this.

Missing else statement in local.js

When using verifyPassword with callback i get

Error: Can't set headers after they are sent.

You need to add else statement to last call to done

                return done(err, !err && isMatch ? user : false);
            });
        } else {
            return done(err, false);
        }

crashes latest railwayjs (out of memory)

After creating a new railwayjs install in Win32, running railway generate crud post title content, I add this line to my environment.js (no other changes):

var rwps = require('railway-passport');

Then I attempt to start the server and get this error:

C:\node\test\railway-passport>railway server
FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory

For reference, here is the config/environment.js file:

var express    = require('express');
var rwps = require('railway-passport');

app.configure(function(){
    var cwd = process.cwd();

    app.use(express.static(cwd + '/public', {maxAge: 86400000}));
    app.set('views', cwd + '/app/views');
    app.set('view engine', 'ejs');
    app.set('view options', {complexNames: true});
    app.set('jsDirectory', '/javascripts/');
    app.set('cssDirectory', '/stylesheets/');
    app.use(express.bodyParser());
    app.use(express.cookieParser('secret'));
    app.use(express.session({secret: 'secret'}));
    app.use(express.methodOverride());
   //init passport
//   rwps.init();
//   // hook up user model
//   process.nextTick(function () {
//      rwps.loadUser(User);
//   });
    app.use(app.router);
});

And here is my version data:

C:\Documents and Settings\a93453\My Documents\workspaces\tests\auth>node -v
v0.6.13

C:\Documents and Settings\a93453\My Documents\workspaces\tests\auth>npm ls
npm WARN [email protected] package.json: bugs['name'] should probably be bugs['url']
[email protected] C:\Documents and Settings\a93453\My Documents\workspaces\tests\auth
├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│   ├── [email protected]
│   ├─┬ [email protected]
│   │ ├── [email protected]
│   │ └── [email protected]
│   ├── [email protected]
│   ├── [email protected]
│   ├─┬ [email protected]
│   │ └── [email protected]
│   ├─┬ [email protected]
│   │ └─┬ [email protected]
│   │   └─┬ [email protected]
│   │     ├── [email protected]
│   │     └── [email protected]
│   ├── [email protected]
│   └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └── [email protected]
├─┬ [email protected]  extraneous
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

npm registry shows 'compound-passport' as 'Not Found'

Error: Not Found
at ServerResponse.error (/home/node/npm-www/node_modules/error-page/error-page.js:108:20)
at MC.ondone (/home/node/npm-www/routes/package-page.js:31:53)
at MC.next (/home/node/npm-www/node_modules/emcee/emcee.js:45:12)
at AsyncCache.get (/home/node/npm-www/node_modules/async-cache/ac.js:58:7)
at Array.forEach (native)
at AsyncCache.get (/home/node/npm-www/node_modules/async-cache/ac.js:57:9)
at CouchLogin. (/home/node/npm-www/models/downloads.js:108:12)
at CouchLogin. (/home/node/npm-www/node_modules/couch-login/couch-login.js:161:15)
at Request.init.self.callback (/home/node/npm-www/node_modules/request/index.js:148:22)
at Request.EventEmitter.emit (events.js:99:17)

findOrCreate Error

Getting this error on /callback... using facebook strategy
TypeError: Cannot call method 'findOrCreate' of undefined
at Strategy.exports.callback as _verify

Also what would be the simplest way to override say /strategies/facebook.js or more precisely the callback to be used on facebook.js strategy

Please help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.