calling onSuccessfulLogin on successful login

This commit is contained in:
Julian Lam 2016-03-30 12:09:31 -04:00
parent d1d9ab0cee
commit 354850244b
2 changed files with 9 additions and 3 deletions

View File

@ -25,9 +25,11 @@
path = module.parent.require('path'), path = module.parent.require('path'),
nconf = module.parent.require('nconf'), nconf = module.parent.require('nconf'),
winston = module.parent.require('winston'), winston = module.parent.require('winston'),
async = module.parent.require('async'), async = module.parent.require('async');
constants = Object.freeze({ var authenticationController = module.parent.require('./controllers/authentication');
var constants = Object.freeze({
type: '', // Either 'oauth' or 'oauth2' type: '', // Either 'oauth' or 'oauth2'
name: '', // Something unique to your OAuth provider in lowercase, like "github", or "nodebb" name: '', // Something unique to your OAuth provider in lowercase, like "github", or "nodebb"
oauth: { oauth: {
@ -76,6 +78,8 @@
OAuth.parseUserReturn(json, function(err, profile) { OAuth.parseUserReturn(json, function(err, profile) {
if (err) return done(err); if (err) return done(err);
profile.provider = constants.name; profile.provider = constants.name;
authenticationController.onSuccessfulLogin(req, user.uid);
done(null, profile); done(null, profile);
}); });
} catch(e) { } catch(e) {
@ -97,6 +101,8 @@
OAuth.parseUserReturn(json, function(err, profile) { OAuth.parseUserReturn(json, function(err, profile) {
if (err) return done(err); if (err) return done(err);
profile.provider = constants.name; profile.provider = constants.name;
authenticationController.onSuccessfulLogin(req, user.uid);
done(null, profile); done(null, profile);
}); });
} catch(e) { } catch(e) {

View File

@ -31,7 +31,7 @@
"passport-oauth": "~1.0.0" "passport-oauth": "~1.0.0"
}, },
"nbbpm": { "nbbpm": {
"compatibility": "^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0", "compatibility": "^1.0.1",
"index": false "index": false
} }
} }