sign up routes for lockit middleware
JavaScript HTML Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
views
.eslintrc
.gitignore
.npmignore
.travis.yml
History.md
Makefile
README.md
index.js
package.json

README.md

Lockit signup

Build Status NPM version Dependency Status

Sign up users to your Express app. The module is part of Lockit.

Installation

npm install lockit-signup

var Signup = require('lockit-signup');
var lockitUtils = require('lockit-utils');
var config = require('./config.js');

var db = lockitUtils.getDatabase(config);
var adapter = require(db.adapter)(config);

var app = express();

// express settings
// ...
// sessions are required - either cookie or some sort of db
app.use(cookieParser());
app.use(cookieSession({
  secret: 'this is my super secret string'
}));

// create new Signup instance
var signup = new Signup(config, adapter);

// use signup.router with your app
app.use(signup.router);

Configuration

More about configuration at lockit.

Features

  • validate inputs
  • hash password
  • validation link expiration
  • verify email address via unique tokens
  • prevent duplicate email/username sign up
  • resend verification email

Routes included

  • GET /signup
  • POST /signup
  • GET /signup/:token
  • GET /signup/resend-verification
  • POST /signup/resend-verification

REST API

If you've set exports.rest = true in your config.js the module behaves as follows.

  • all routes have /rest prepended
  • GET /rest/signup is next()ed and you can catch /signup on the client
  • POST /rest/signup stays the same but only sends JSON
  • GET /rest/signup/:token sends JSON
  • GET /rest/signup/resend-verification is next()ed and you can catch /signup/resend-verification on the client
  • POST /rest/signup/resend-verification sends JSON

Test

grunt

License

MIT