This commit is contained in:
Luke Slater 2014-10-21 15:08:26 +00:00
parent c4828f7ef4
commit cd92f0c4de
4 changed files with 19 additions and 11 deletions

View File

@ -129,14 +129,18 @@ var atheme = function(dbot) {
}, this); }, this);
} }
} else { // PRIVMSG } else { // PRIVMSG
console.log(event.message);
var akill = event.message.match(/([^ ]+) AKILL:ADD: ([^ ]+) \(reason: (.+)(\) )\(duration: ([^,)]+)/); var akill = event.message.match(/([^ ]+) AKILL:ADD: ([^ ]+) \(reason: (.+)(\) )\(duration: ([^,)]+)/);
if(event.channel == '#services' && akill) { if(event.channel == '#services' && akill) {
var channel = dbot.config.servers[server].admin_channel; console.log(akill);
dbot.api.report.notify('ban', 'tripsit', akill[1], channel, dbot.t('akill', { var channel = dbot.config.servers[event.server].admin_channel;
'host': akill[2], dbot.api.users.getUser(akill[1] + '.' + event.server, function(err, user) {
'reason': akill[3], dbot.api.report.notify('ban', 'tripsit', user, channel, dbot.t('akill', {
'duration': akill[4] 'host': akill[2],
})); 'reason': akill[3],
'duration': akill[5]
}));
});
} }
} }
}.bind(this); }.bind(this);

View File

@ -35,7 +35,7 @@ var users = function(dbot) {
'user': user.id 'user': user.id
}, function(err, result) { }, function(err, result) {
if(!err) { if(!err) {
dbot.api.event.emit('new_user_alias', [ user, alias ]); dbot.api.event.emit('new_user_alias', [ result, alias ]);
callback(null, result); callback(null, result);
} else { } else {
callback(true, null); callback(true, null);

View File

@ -28,6 +28,7 @@ var api = function(dbot) {
accessNeeded, accessNeeded,
allowedNicks; allowedNicks;
console.log('haxess called');
if(mConfig.requireWebLogin == true) { if(mConfig.requireWebLogin == true) {
if(req.isAuthenticated()) { if(req.isAuthenticated()) {
if(_.has(mConfig, 'pageAccess') && _.has(mConfig.pageAccess, path)) { if(_.has(mConfig, 'pageAccess') && _.has(mConfig.pageAccess, path)) {
@ -56,7 +57,8 @@ var api = function(dbot) {
} else { } else {
res.render('login', { res.render('login', {
'message': 'You need to log in to access this module.', 'message': 'You need to log in to access this module.',
'redirect': req.originalUrl 'redirect': req.originalUrl,
'routes': dbot.modules.web.indexLinks
}); });
} }
} else { } else {

View File

@ -78,6 +78,7 @@ var webInterface = function(dbot) {
var func = pages[p], var func = pages[p],
mod = func.module; mod = func.module;
console.log('adding ' + p);
this.app.get(p, this.api.hasAccess, (function(req, resp) { this.app.get(p, this.api.hasAccess, (function(req, resp) {
// Crazy shim to seperate module views. // Crazy shim to seperate module views.
var shim = Object.create(resp); var shim = Object.create(resp);
@ -123,14 +124,15 @@ var webInterface = function(dbot) {
this.app.get('/login', function(req, res) { this.app.get('/login', function(req, res) {
res.render('login', { res.render('login', {
'user': req.user, 'user': req.user,
'message': req.flash('error') 'message': req.flash('error'),
'routes': this.indexLinks
}); });
}); }.bind(this));
this.app.post('/login', passport.authenticate('local', { this.app.post('/login', passport.authenticate('local', {
'failureRedirect': '/login', 'failureRedirect': '/login',
'failureFlash': true, 'failureFlash': true,
'routes': dbot.modules.web.indexLinks 'routes': this.indexLinks
}), function(req, res) { }), function(req, res) {
if(req.body.redirect) { if(req.body.redirect) {
res.redirect(req.body.redirect); res.redirect(req.body.redirect);