mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
accidentally developed on a merge commit... *fingers crossed*
Merge branch 'master' of github.com:psychobunny/node-forum Conflicts: public/templates/login.tpl
This commit is contained in:
33
src/user.js
33
src/user.js
@@ -146,7 +146,32 @@ var config = require('../config.js'),
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
User.loginViaGoogle = function(gplusid, handle, email, callback) {
|
||||
User.get_uid_by_google_id(gplusid, function(uid) {
|
||||
if (uid !== null) {
|
||||
// Existing User
|
||||
callback(null, {
|
||||
uid: uid
|
||||
});
|
||||
} else {
|
||||
// New User
|
||||
User.create(handle, null, email, function(err, uid) {
|
||||
if (err !== null) {
|
||||
callback(err);
|
||||
} else {
|
||||
// Save twitter-specific information to the user
|
||||
RDB.set('uid:' + uid + ':gplusid', gplusid);
|
||||
RDB.set('gplusid:' + gplusid + ':uid', uid);
|
||||
callback(null, {
|
||||
uid: uid
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
User.logout = function(sessionID, callback) {
|
||||
@@ -224,6 +249,12 @@ var config = require('../config.js'),
|
||||
});
|
||||
}
|
||||
|
||||
User.get_uid_by_google_id = function(gplusid, callback) {
|
||||
RDB.get('gplusid:' + gplusid + ':uid', function(uid) {
|
||||
callback(uid);
|
||||
});
|
||||
}
|
||||
|
||||
User.session_ping = function(sessionID, uid) {
|
||||
// Start, replace, or extend a session
|
||||
RDB.get('sess:' + sessionID, function(session) {
|
||||
|
||||
Reference in New Issue
Block a user