Delete user accounts in your Express app. The module is part of Lockit.
npm install lockit-delete-account
var DeleteAccount = require('lockit-delete-account');
var utils = require('lockit-utils');
var config = require('./config.js');
var db = utils.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 DeleteAccount instance
var deleteAccount = new DeleteAccount(config, adapter);
// use deleteAccount.router with your app
app.use(deleteAccount.router);
More about configuration at Lockit.
- input validation
- match public phrase
- session verification
- kill current session
- remove user from db
- GET /delete-account
- POST /delete-account
If you've set exports.rest
in your config.js
the module behaves as follows.
- all routes have
/rest
prepended GET /rest/delete-account
isnext()
ed and you can catch/delete-account
on the clientPOST /rest/delete-account
stays the same but sends JSON
grunt
MIT