The plugin seamlessly handles account history events. When used with any auth
plugin, an entry will
be created in the history table, describing the action that occurred (login, logout, change password, etc). It does so by creating
a new table (by default, account_history
) and starts listening for auth:history
events
coming from the dispatcher.
For now, the plugin only works with store-sql
, therefore it is a dependency you shoul have configured
for your application.
npm i --save thorin-plugin-auth-history@1.x
'use strict'; // app.js entry file const thorin = require('thorin'); thorin.addPlugin(require('thorin-plugin-auth-history')); // <- add this line thorin.run((err) => {});
# run to setup the models node app.js --setup=plugin.auth-history
If you want to add additional fields to the history table, create a new file in app/models/{opt.history.modelName}.js, and export a function called extend. It will receive the history model object and the Sequelize instance.
'use strict';
// File: app/models/accountHistory.js
module.exports = function extend(modelObj, Seq) {
modelObj
.field('location', Seq.STRING)
.field('app_source', Seq.STRING)
// add as many fields and methods you want.
};
You can always create a new issue on GitHub or contact one of the core founders by chat.