Removing Twitter SSO - toodles!

v1.18.x
Julian Lam 11 years ago
parent e7eab83d8f
commit 7e3c46db61

@ -115,7 +115,6 @@
<div class="well sidebar-nav">
<ul class="nav nav-list">
<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/gplus"><i class="fa fa-fw fa-google-plus-square"></i> Google+</a></li>
<!-- BEGIN authentication -->
<li>

@ -1,23 +0,0 @@
<h1><i class="fa fa-twitter-square"></i> Twitter Social Authentication</h1>
<hr />
<form>
<div class="alert alert-warning">
<p>
Create a <strong>Twitter Application</strong> via the
<a href="https://dev.twitter.com/">Twitter Developers Page</a> and then
paste your application details here.
</p>
<br />
<input type="text" data-field="social:twitter:key" title="Consumer Key" class="form-control input-lg" placeholder="Consumer Key"><br />
<input type="text" data-field="social:twitter:secret" title="Consumer Secret" class="form-control input-md" placeholder="Consumer Secret">
</div>
</form>
<button class="btn btn-lg btn-primary" id="save">Save</button>
<script>
require(['forum/admin/settings'], function(Settings) {
Settings.prepare();
});
</script>

@ -11,7 +11,6 @@
"^admin/plugins/?$": "admin/plugins",
"^admin/languages/?$": "admin/languages",
"^admin/settings.*": "admin/settings",
"^admin/twitter.*": "admin/twitter",
"^admin/logger.*": "admin/logger",
"^admin/gplus.*": "admin/gplus",
"^admin/motd/?$": "admin/motd",

@ -57,44 +57,6 @@ var user = require('./user'),
}
}
Login.loginViaTwitter = function(twid, handle, photos, callback) {
user.getUidByTwitterId(twid, function(err, uid) {
if(err) {
return callback(err);
}
if (uid !== null) {
// Existing User
callback(null, {
uid: uid
});
} else {
// New User
user.create({username: handle}, function(err, uid) {
if(err) {
return callback(err);
}
// Save twitter-specific information to the user
user.setUserField(uid, 'twid', twid);
db.setObjectField('twid:uid', twid, uid);
// Save their photo, if present
if (photos && photos.length > 0) {
var photoUrl = photos[0].value;
photoUrl = path.dirname(photoUrl) + '/' + path.basename(photoUrl, path.extname(photoUrl)).slice(0, -6) + 'bigger' + path.extname(photoUrl);
user.setUserField(uid, 'uploadedpicture', photoUrl);
user.setUserField(uid, 'picture', photoUrl);
}
callback(null, {
uid: uid
});
});
}
});
};
Login.loginViaGoogle = function(gplusid, handle, email, callback) {
user.getUidByGoogleId(gplusid, function(err, uid) {
if(err) {

@ -58,7 +58,7 @@ var nconf = require('nconf'),
(function () {
var routes = [
'categories/active', 'categories/disabled', 'users', 'topics', 'settings', 'themes',
'twitter', 'gplus', 'database', 'events', 'motd', 'groups', 'plugins',
'gplus', 'database', 'events', 'motd', 'groups', 'plugins',
'languages', 'logger',
'users/latest', 'users/sort-posts', 'users/sort-reputation', 'users/search'
];
@ -409,10 +409,6 @@ var nconf = require('nconf'),
res.json(200, {});
});
app.get('/twitter', function (req, res) {
res.json(200, {});
});
app.get('/gplus', function (req, res) {
res.json(200, {});
});

@ -1,7 +1,6 @@
(function(Auth) {
var passport = require('passport'),
passportLocal = require('passport-local').Strategy,
passportTwitter = require('passport-twitter').Strategy,
passportGoogle = require('passport-google-oauth').OAuth2Strategy,
login_strategies = [],
nconf = require('nconf'),
@ -31,29 +30,6 @@
});
});
if (meta.config['social:twitter:key'] && meta.config['social:twitter:secret']) {
passport.use(new passportTwitter({
consumerKey: meta.config['social:twitter:key'],
consumerSecret: meta.config['social:twitter:secret'],
callbackURL: nconf.get('url') + '/auth/twitter/callback'
}, function(token, tokenSecret, profile, done) {
login_module.loginViaTwitter(profile.id, profile.username, profile.photos, function(err, user) {
if (err) {
return done(err);
}
done(null, user);
});
}));
login_strategies.push({
name: 'twitter',
url: '/auth/twitter',
callbackURL: '/auth/twitter/callback',
icon: 'twitter',
scope: ''
});
}
if (meta.config['social:google:id'] && meta.config['social:google:secret']) {
passport.use(new passportGoogle({
clientID: meta.config['social:google:id'],

@ -742,15 +742,6 @@ var bcrypt = require('bcrypt'),
});
};
User.getUidByTwitterId = function(twid, callback) {
db.getObjectField('twid:uid', twid, function(err, uid) {
if (err) {
return callback(err);
}
callback(null, uid);
});
};
User.getUidByGoogleId = function(gplusid, callback) {
db.getObjectField('gplusid:uid', gplusid, function(err, uid) {
if (err) {

Loading…
Cancel
Save