Skip to content

Commit

Permalink
Move user related plugins into ept-users
Browse files Browse the repository at this point in the history
  • Loading branch information
akinsey committed Jun 26, 2019
1 parent 9a88a2d commit 7673e68
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions modules/ept-users/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ var routes = require(path.normalize(__dirname + '/routes'));
var common = require(path.normalize(__dirname + '/common'));
var permissions = require(path.normalize(__dirname + '/permissions'));
var authorization = require(path.normalize(__dirname + '/authorization'));
var plugins = require(path.normalize(__dirname + '/plugins'));

module.exports = {
name: 'users',
permissions: permissions,
routes: routes,
common: common.export(),
authorization: authorization,
plugins: plugins,
db: db
};
9 changes: 9 additions & 0 deletions modules/ept-users/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var path = require('path');

module.exports = [
{ register: require(path.normalize(__dirname + '/last-active')) },
{
register: require(path.normalize(__dirname + '/track-ip')),
db: true
}
];
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
var Boom = require('boom');

exports.register = function(plugin, options, next) {
options = options || {};

plugin.ext('onPostAuth', function(request, reply) {
// check if user is authed
var authed = request.auth.isAuthenticated;
Expand Down
File renamed without changes.
6 changes: 0 additions & 6 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ var limiter = require(path.normalize(__dirname + '/plugins/limiter'));
var sanitizer = require(path.normalize(__dirname + '/plugins/sanitizer'));
var serverOptions = require(path.normalize(__dirname + '/server-options'));
var logOptions = require(path.normalize(__dirname + '/log-options'));
var lastActive = require(path.normalize(__dirname + '/plugins/last_active'));
var AuthValidate = require(path.normalize(__dirname + '/plugins/jwt/validate'));
var trackIp = require(path.normalize(__dirname + '/plugins/track_ip'));

var server, additionalRoutes, commonMethods, authMethods, permissions, roles, hookMethods, plugins, parsers;

Expand Down Expand Up @@ -134,10 +132,6 @@ setup()
})
// emailer
.then(function() { return server.register({ register: emailer, options: { config } }); })
// Track IP
.then(function() { return server.register({ register: trackIp, options: { db } }); })
// Last Active
.then(function() { return server.register({ register: lastActive }); })
// plugins methods
.then(function() {
return loadModulePlugins(plugins);
Expand Down

0 comments on commit 7673e68

Please sign in to comment.