mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	removing facebook SSO from core
This commit is contained in:
		| @@ -1,23 +0,0 @@ | |||||||
| <h1><i class="fa fa-facebook-square"></i> Facebook Social Authentication</h1> |  | ||||||
| <hr /> |  | ||||||
|  |  | ||||||
| <form> |  | ||||||
| 	<div class="alert alert-warning"> |  | ||||||
| 		<p> |  | ||||||
| 			Create a <strong>Facebook Application</strong> via the |  | ||||||
| 			<a href="https://developers.facebook.com/">Facebook Developers Page</a> and |  | ||||||
| 			then paste your application details here. |  | ||||||
| 		</p> |  | ||||||
| 		<br /> |  | ||||||
| 		<input type="text" data-field="social:facebook:app_id" title="Application ID" class="form-control input-lg" placeholder="App ID"><br /> |  | ||||||
| 		<input type="text" data-field="social:facebook:secret" title="Application Secret" class="form-control input-md" placeholder="App 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> |  | ||||||
| @@ -116,7 +116,6 @@ | |||||||
| 					<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/twitter"><i class="fa fa-fw fa-twitter-square"></i> Twitter</a></li> | 						<li><a href="{relative_path}/admin/twitter"><i class="fa fa-fw fa-twitter-square"></i> Twitter</a></li> | ||||||
| 						<li><a href="{relative_path}/admin/facebook"><i class="fa fa-fw fa-facebook-square"></i> Facebook</a></li> |  | ||||||
| 						<li><a href="{relative_path}/admin/gplus"><i class="fa fa-fw fa-google-plus-square"></i> Google+</a></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> | ||||||
|   | |||||||
| @@ -12,7 +12,6 @@ | |||||||
| 		"^admin/languages/?$": "admin/languages", | 		"^admin/languages/?$": "admin/languages", | ||||||
| 		"^admin/settings.*": "admin/settings", | 		"^admin/settings.*": "admin/settings", | ||||||
| 		"^admin/twitter.*": "admin/twitter", | 		"^admin/twitter.*": "admin/twitter", | ||||||
| 		"^admin/facebook.*": "admin/facebook", |  | ||||||
| 		"^admin/logger.*": "admin/logger", | 		"^admin/logger.*": "admin/logger", | ||||||
| 		"^admin/gplus.*": "admin/gplus", | 		"^admin/gplus.*": "admin/gplus", | ||||||
| 		"^admin/motd/?$": "admin/motd", | 		"^admin/motd/?$": "admin/motd", | ||||||
|   | |||||||
							
								
								
									
										43
									
								
								src/login.js
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								src/login.js
									
									
									
									
									
								
							| @@ -138,47 +138,4 @@ var user = require('./user'), | |||||||
| 		}); | 		}); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	Login.loginViaFacebook = function(fbid, name, email, callback) { |  | ||||||
| 		user.getUidByFbid(fbid, 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 facebook-specific information to the user |  | ||||||
| 					user.setUserField(uid, 'fbid', fbid); |  | ||||||
| 					db.setObjectField('fbid:uid', fbid, uid); |  | ||||||
| 					callback(null, { |  | ||||||
| 						uid: uid |  | ||||||
| 					}); |  | ||||||
| 				}; |  | ||||||
|  |  | ||||||
| 				user.getUidByEmail(email, function(err, uid) { |  | ||||||
| 					if(err) { |  | ||||||
| 						return callback(err); |  | ||||||
| 					} |  | ||||||
|  |  | ||||||
| 					if (!uid) { |  | ||||||
| 						user.create({username: name, email: email}, function(err, uid) { |  | ||||||
| 							if(err) { |  | ||||||
| 								return callback(err); |  | ||||||
| 							} |  | ||||||
|  |  | ||||||
| 							success(uid); |  | ||||||
| 						}); |  | ||||||
| 					} else { |  | ||||||
| 						success(uid); // Existing account -- merge |  | ||||||
| 					} |  | ||||||
| 				}); |  | ||||||
| 			} |  | ||||||
| 		}); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| }(exports)); | }(exports)); | ||||||
|   | |||||||
| @@ -58,7 +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', | ||||||
| 				'twitter', 'facebook', 'gplus', 'database', 'events', 'motd', 'groups', 'plugins', | 				'twitter', 'gplus', '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' | ||||||
| 			]; | 			]; | ||||||
| @@ -413,10 +413,6 @@ var nconf = require('nconf'), | |||||||
| 				res.json(200, {}); | 				res.json(200, {}); | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			app.get('/facebook', function (req, res) { |  | ||||||
| 				res.json(200, {}); |  | ||||||
| 			}); |  | ||||||
|  |  | ||||||
| 			app.get('/gplus', function (req, res) { | 			app.get('/gplus', function (req, res) { | ||||||
| 				res.json(200, {}); | 				res.json(200, {}); | ||||||
| 			}); | 			}); | ||||||
|   | |||||||
| @@ -3,7 +3,6 @@ | |||||||
| 		passportLocal = require('passport-local').Strategy, | 		passportLocal = require('passport-local').Strategy, | ||||||
| 		passportTwitter = require('passport-twitter').Strategy, | 		passportTwitter = require('passport-twitter').Strategy, | ||||||
| 		passportGoogle = require('passport-google-oauth').OAuth2Strategy, | 		passportGoogle = require('passport-google-oauth').OAuth2Strategy, | ||||||
| 		passportFacebook = require('passport-facebook').Strategy, |  | ||||||
| 		login_strategies = [], | 		login_strategies = [], | ||||||
| 		nconf = require('nconf'), | 		nconf = require('nconf'), | ||||||
| 		meta = require('../meta'), | 		meta = require('../meta'), | ||||||
| @@ -78,29 +77,6 @@ | |||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (meta.config['social:facebook:app_id'] && meta.config['social:facebook:secret']) { |  | ||||||
| 		passport.use(new passportFacebook({ |  | ||||||
| 			clientID: meta.config['social:facebook:app_id'], |  | ||||||
| 			clientSecret: meta.config['social:facebook:secret'], |  | ||||||
| 			callbackURL: nconf.get('url') + '/auth/facebook/callback' |  | ||||||
| 		}, function(accessToken, refreshToken, profile, done) { |  | ||||||
| 			login_module.loginViaFacebook(profile.id, profile.displayName, profile.emails[0].value, function(err, user) { |  | ||||||
| 				if (err) { |  | ||||||
| 					return done(err); |  | ||||||
| 				} |  | ||||||
| 				done(null, user); |  | ||||||
| 			}); |  | ||||||
| 		})); |  | ||||||
|  |  | ||||||
| 		login_strategies.push({ |  | ||||||
| 			name: 'facebook', |  | ||||||
| 			url: '/auth/facebook', |  | ||||||
| 			callbackURL: '/auth/facebook/callback', |  | ||||||
| 			icon: 'facebook', |  | ||||||
| 			scope: 'email' |  | ||||||
| 		}); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	passport.serializeUser(function(user, done) { | 	passport.serializeUser(function(user, done) { | ||||||
| 		done(null, user.uid); | 		done(null, user.uid); | ||||||
| 	}); | 	}); | ||||||
|   | |||||||
| @@ -760,15 +760,6 @@ var bcrypt = require('bcrypt'), | |||||||
| 		}); | 		}); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	User.getUidByFbid = function(fbid, callback) { |  | ||||||
| 		db.getObjectField('fbid:uid', fbid, 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