0.3.3 • Published 11 years ago

nodefly-register v0.3.3

Weekly downloads
324
License
BSD
Repository
github
Last release
11 years ago

nodefly-register

Easily register user accounts with nodefly/StrongOps and retrieve the user record.

npm install nodefly-register

Usage

var register = require('nodefly-register');

Create account

var userData = {
	name: 'me',
	email: 'me@example.com',
	password: 'password'
};

register.register(userData, function(err, user) {...});

Where err is an Error object whose message will be:

'Bad Password' // if the password contains less than 8 chars
'User Exists' // if that email is already in the db

The user should look like:

{
  id: '86988a2d69135de9e6a5677ab3be498b',
  name: 'me',
  userKey: '86988a2d69135de9e6a5677ab3be498b',
  email: 'test@strongloop.com',
  created: '2013-08-31T05:33:52.000Z',
  apps: [],
  sid: 'lrkPTmBKvMSPJYsmIPxvX1Zc',
  loggedIn: true
}

Login

Same userData as above but name is not required.

register.login(userData, function (err, user) {...});

The user returned is the same format as above.

Delete account

Same userData as above but name is not required.

register.cancel(userData, function (err, res) {...});