- update dependencies
- fix #36 #29
- update lockit-sendmail with nodemailer 1.x
- update dependencies
- fix bug where different lockit instances share the same config object
- update dependencies
- add events
'forgot::sent'
and'forgot::success'
- update dependencies
- expose db adapter as
lockit.adapter
- allow usage of custom db adapter (fix #15)
- use
utils.pipe
method for event piping - update dependencies
- add tests for event emitter
-
requires Express 4.x
-
makes use of
express.Router()
. No need to passapp
around as an argument.old
var Lockit = require('lockit'); var lockit = new Lockit(app, config);
new
var Lockit = require('lockit'); var lockit = new Lockit(config); app.use(lockit.router);
Listening on events stays the same.
lockit.on('login', function(user, res, target) { res.send('Welcome ' + user.name); })
-
proper Error handling. All Errors are piped to next middleware.
old
if (err) console.log(err);
new
if (err) return next(err);
Make sure you have some sort of error handling middleware at the end of your routes (is included by default in Express 4.x apps if you use the
express-generator
). -
database configuration is a single object
old
// database settings for CouchDB exports.db = 'http://127.0.0.1:5984/test'; // or if you want to use MongoDB // exports.db = 'mongodb://127.0.0.1/test'; // exports.dbCollection = 'users';
new
// database settings for CouchDB exports.db = { url: 'http://127.0.0.1:5984/' // important: no db at the end } // you can still use the short notation for CouchDB // because CouchDB doesn't need 'name' and 'collection' // exports.db = 'http://127.0.0.1:5984/'; // or if you want to use MongoDB (SQL is similar) // exports.db = { // url: 'mongodb://127.0.0.1/', // name: 'test', // collection: 'users' // }
- username (
name
) has to be lowercase and has to start with a letter
-
per-user database with
_security
document in CouchDB with all users in_users
database -
add support for optional
request_defaults
(used by lockit-couchdb-adapter)exports.request_defaults = { // proxy: 'http://someproxy' };
-
username
becomesname
-
improve
rest
config settingseither
exports.rest = false; // default setting
or
exports.rest = { // set starting page for single page app index: 'public/index.html', // use view engine (render()) or send static file (sendfile()) useViewEngine: false }
-
add
exports.restIndexPage = 'public/index.html'
to default configYou are now able to specify the starting page for your single page application. It defaults to
public/index.html
. The path is relative to yourapp.js
. You can also choose a.jade
fileexports.restIndexPage = 'main.jade'
. The path for the.jade
file is relative to the folder you've set viaapp.set('views', __dirname + '/views')
(in this case theviews/
folder).
...
- replace xtend by node.extend to allow for nested object in default config
- drop
dbUrl
and only usedb
inconfig.js
for connection string - drop
title
from email messages and usesubject
instead - get type of database and lockit adapter from db connection string
- enable custom views