Lockit forgot password
Help users who forgot their passwords for your Express app. The module is part of Lockit.
Installation
npm install lockit-forgot-password
var ForgotPassword = ;var utils = ;var config = ; var db = utils;var adapter = config; var app = ; // express settings// ...// sessions are required - either cookie or some sort of dbapp;app; // create new ForgotPassword instancevar forgotPassword = config adapter; // use forgotPassword.router with your appapp;
Configuration
More about configuration at Lockit.
Features
- allow password reset for users
- input validation
- link expiration times
- user email verification via unique token
- hash password using pbkdf2
- token format verification before database querying
Routes included
- GET /forgot-password
- POST /forgot-password
- GET /forgot-password/:token
- POST /forgot-password/:token
REST API
If you've set exports.rest
in your config.js
the module behaves as follows.
- all routes have
/rest
prepended GET /rest/forgot-password
isnext()
ed and you can catch/forgot-password
on the clientPOST /rest/forgot-password
stays the same but sends JSONGET /rest/forgot-password/:token
sends JSON and you can catch/forgot-password/:token
on the clientPOST /rest/forgot-password/:token
sends JSON
Test
$ npm test
License
MIT