mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	Removing Google Plus integration from core - adios!
This commit is contained in:
		| @@ -1,23 +0,0 @@ | |||||||
| <h1><i class="fa fa-google-plus-square"></i> Google Accounts Social Authentication</h1> |  | ||||||
| <hr /> |  | ||||||
|  |  | ||||||
| <form> |  | ||||||
| 	<div class="alert alert-warning"> |  | ||||||
| 		<p> |  | ||||||
| 			Create a <strong>Google Application</strong> via the |  | ||||||
| 			<a href="https://code.google.com/apis/console/">API Console</a> and then paste |  | ||||||
| 			your application details here. |  | ||||||
| 		</p> |  | ||||||
| 		<br /> |  | ||||||
| 		<input type="text" data-field="social:google:id" title="Client ID" class="form-control input-lg" placeholder="Client ID"><br /> |  | ||||||
| 		<input type="text" data-field="social:google:secret" title="Client Secret" class="form-control" placeholder="Client Secret"><br /> |  | ||||||
| 	</div> |  | ||||||
| </form> |  | ||||||
|  |  | ||||||
| <button class="btn btn-lg btn-primary" id="save">Save</button> |  | ||||||
|  |  | ||||||
| <script> |  | ||||||
| 	require(['forum/admin/settings'], function(Settings) { |  | ||||||
| 		Settings.prepare(); |  | ||||||
| 	}); |  | ||||||
| </script> |  | ||||||
| @@ -115,7 +115,6 @@ | |||||||
| 				<div class="well sidebar-nav"> | 				<div class="well sidebar-nav"> | ||||||
| 					<ul class="nav nav-list"> | 					<ul class="nav nav-list"> | ||||||
| 						<li class="nav-header">Social Authentication</li> | 						<li class="nav-header">Social Authentication</li> | ||||||
| 						<li><a href="{relative_path}/admin/gplus"><i class="fa fa-fw fa-google-plus-square"></i> Google+</a></li> |  | ||||||
| 						<!-- BEGIN authentication --> | 						<!-- BEGIN authentication --> | ||||||
| 						<li> | 						<li> | ||||||
| 							<a href="{relative_path}/admin{authentication.route}"><i class="fa fa-fw {authentication.icon}"></i> {authentication.name}</a> | 							<a href="{relative_path}/admin{authentication.route}"><i class="fa fa-fw {authentication.icon}"></i> {authentication.name}</a> | ||||||
|   | |||||||
| @@ -12,7 +12,6 @@ | |||||||
| 		"^admin/languages/?$": "admin/languages", | 		"^admin/languages/?$": "admin/languages", | ||||||
| 		"^admin/settings.*": "admin/settings", | 		"^admin/settings.*": "admin/settings", | ||||||
| 		"^admin/logger.*": "admin/logger", | 		"^admin/logger.*": "admin/logger", | ||||||
| 		"^admin/gplus.*": "admin/gplus", |  | ||||||
| 		"^admin/motd/?$": "admin/motd", | 		"^admin/motd/?$": "admin/motd", | ||||||
| 		"^admin/groups/?$": "admin/groups", | 		"^admin/groups/?$": "admin/groups", | ||||||
| 		"^users/sort-posts": "users", | 		"^users/sort-posts": "users", | ||||||
|   | |||||||
							
								
								
									
										44
									
								
								src/login.js
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								src/login.js
									
									
									
									
									
								
							| @@ -56,48 +56,4 @@ var user = require('./user'), | |||||||
| 			}); | 			}); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Login.loginViaGoogle = function(gplusid, handle, email, callback) { |  | ||||||
| 		user.getUidByGoogleId(gplusid, function(err, uid) { |  | ||||||
| 			if(err) { |  | ||||||
| 				return callback(err); |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			if (uid !== null) { |  | ||||||
| 				// Existing User |  | ||||||
| 				callback(null, { |  | ||||||
| 					uid: uid |  | ||||||
| 				}); |  | ||||||
| 			} else { |  | ||||||
| 				// New User |  | ||||||
| 				var success = function(uid) { |  | ||||||
| 					// Save google-specific information to the user |  | ||||||
| 					user.setUserField(uid, 'gplusid', gplusid); |  | ||||||
| 					db.setObjectField('gplusid:uid', gplusid, uid); |  | ||||||
| 					callback(null, { |  | ||||||
| 						uid: uid |  | ||||||
| 					}); |  | ||||||
| 				}; |  | ||||||
|  |  | ||||||
| 				user.getUidByEmail(email, function(err, uid) { |  | ||||||
| 					if(err) { |  | ||||||
| 						return callback(err); |  | ||||||
| 					} |  | ||||||
|  |  | ||||||
| 					if (!uid) { |  | ||||||
| 						user.create({username: handle, email: email}, function(err, uid) { |  | ||||||
| 							if(err) { |  | ||||||
| 								return callback(err); |  | ||||||
| 							} |  | ||||||
|  |  | ||||||
| 							success(uid); |  | ||||||
| 						}); |  | ||||||
| 					} else { |  | ||||||
| 						success(uid); // Existing account -- merge |  | ||||||
| 					} |  | ||||||
| 				}); |  | ||||||
| 			} |  | ||||||
| 		}); |  | ||||||
| 	}; |  | ||||||
|  |  | ||||||
| }(exports)); | }(exports)); | ||||||
|   | |||||||
| @@ -58,8 +58,7 @@ var nconf = require('nconf'), | |||||||
| 		(function () { | 		(function () { | ||||||
| 			var routes = [ | 			var routes = [ | ||||||
| 				'categories/active', 'categories/disabled', 'users', 'topics', 'settings', 'themes', | 				'categories/active', 'categories/disabled', 'users', 'topics', 'settings', 'themes', | ||||||
| 				'gplus', 'database', 'events', 'motd', 'groups', 'plugins', | 				'database', 'events', 'motd', 'groups', 'plugins', 'languages', 'logger', | ||||||
| 				'languages', 'logger', |  | ||||||
| 				'users/latest', 'users/sort-posts', 'users/sort-reputation', 'users/search' | 				'users/latest', 'users/sort-posts', 'users/sort-reputation', 'users/search' | ||||||
| 			]; | 			]; | ||||||
|  |  | ||||||
| @@ -409,10 +408,6 @@ var nconf = require('nconf'), | |||||||
| 				res.json(200, {}); | 				res.json(200, {}); | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			app.get('/gplus', function (req, res) { |  | ||||||
| 				res.json(200, {}); |  | ||||||
| 			}); |  | ||||||
|  |  | ||||||
| 			app.get('/testing/categories', function (req, res) { | 			app.get('/testing/categories', function (req, res) { | ||||||
| 				res.json(200, {}); | 				res.json(200, {}); | ||||||
| 			}); | 			}); | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| (function(Auth) { | (function(Auth) { | ||||||
| 	var passport = require('passport'), | 	var passport = require('passport'), | ||||||
| 		passportLocal = require('passport-local').Strategy, | 		passportLocal = require('passport-local').Strategy, | ||||||
| 		passportGoogle = require('passport-google-oauth').OAuth2Strategy, |  | ||||||
| 		login_strategies = [], | 		login_strategies = [], | ||||||
| 		nconf = require('nconf'), | 		nconf = require('nconf'), | ||||||
| 		meta = require('../meta'), | 		meta = require('../meta'), | ||||||
| @@ -30,29 +29,6 @@ | |||||||
| 		}); | 		}); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| 	if (meta.config['social:google:id'] && meta.config['social:google:secret']) { |  | ||||||
| 		passport.use(new passportGoogle({ |  | ||||||
| 			clientID: meta.config['social:google:id'], |  | ||||||
| 			clientSecret: meta.config['social:google:secret'], |  | ||||||
| 			callbackURL: nconf.get('url') + '/auth/google/callback' |  | ||||||
| 		}, function(accessToken, refreshToken, profile, done) { |  | ||||||
| 			login_module.loginViaGoogle(profile.id, profile.displayName, profile.emails[0].value, function(err, user) { |  | ||||||
| 				if (err) { |  | ||||||
| 					return done(err); |  | ||||||
| 				} |  | ||||||
| 				done(null, user); |  | ||||||
| 			}); |  | ||||||
| 		})); |  | ||||||
|  |  | ||||||
| 		login_strategies.push({ |  | ||||||
| 			name: 'google', |  | ||||||
| 			url: '/auth/google', |  | ||||||
| 			callbackURL: '/auth/google/callback', |  | ||||||
| 			icon: 'google-plus', |  | ||||||
| 			scope: 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email' |  | ||||||
| 		}); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	passport.serializeUser(function(user, done) { | 	passport.serializeUser(function(user, done) { | ||||||
| 		done(null, user.uid); | 		done(null, user.uid); | ||||||
| 	}); | 	}); | ||||||
|   | |||||||
| @@ -742,15 +742,6 @@ var bcrypt = require('bcrypt'), | |||||||
| 		}); | 		}); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	User.getUidByGoogleId = function(gplusid, callback) { |  | ||||||
| 		db.getObjectField('gplusid:uid', gplusid, function(err, uid) { |  | ||||||
| 			if (err) { |  | ||||||
| 				return callback(err); |  | ||||||
| 			} |  | ||||||
| 			callback(null, uid); |  | ||||||
| 		}); |  | ||||||
| 	}; |  | ||||||
|  |  | ||||||
| 	User.isModerator = function(uid, cid, callback) { | 	User.isModerator = function(uid, cid, callback) { | ||||||
| 		db.isSetMember('cid:' + cid + ':moderators', uid, function(err, exists) { | 		db.isSetMember('cid:' + cid + ':moderators', uid, function(err, exists) { | ||||||
| 			if(err) { | 			if(err) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user