Sign up users to your Express app. The module is part of Lockit.
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);
More about configuration at lockit.
- validate inputs
- hash password
- validation link expiration
- verify email address via unique tokens
- prevent duplicate email/username sign up
- resend verification email
GET /signup
POST /signup
GET /signup/:token
GET /signup/resend-verification
POST /signup/resend-verification
If you've set exports.rest = true
in your config.js
the module behaves as follows.
- all routes have
/rest
prepended GET /rest/signup
isnext()
ed and you can catch/signup
on the clientPOST /rest/signup
stays the same but only sends JSONGET /rest/signup/:token
sends JSONGET /rest/signup/resend-verification
isnext()
ed and you can catch/signup/resend-verification
on the clientPOST /rest/signup/resend-verification
sends JSON
grunt
MIT