3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00
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);
}
} else { // PRIVMSG
console.log(event.message);
var akill = event.message.match(/([^ ]+) AKILL:ADD: ([^ ]+) \(reason: (.+)(\) )\(duration: ([^,)]+)/);
if(event.channel == '#services' && akill) {
var channel = dbot.config.servers[server].admin_channel;
dbot.api.report.notify('ban', 'tripsit', akill[1], channel, dbot.t('akill', {
console.log(akill);
var channel = dbot.config.servers[event.server].admin_channel;
dbot.api.users.getUser(akill[1] + '.' + event.server, function(err, user) {
dbot.api.report.notify('ban', 'tripsit', user, channel, dbot.t('akill', {
'host': akill[2],
'reason': akill[3],
'duration': akill[4]
'duration': akill[5]
}));
});
}
}
}.bind(this);

View File

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

View File

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

View File

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