From c90d062f7b62db64fbb0b3e4fc7d9ec3a770ebe0 Mon Sep 17 00:00:00 2001 From: webdev Date: Sat, 17 Jan 2015 17:44:06 -0500 Subject: [PATCH] Enables twitter users to immediately log in to FCC without having to reauthorize the app --- app.js | 2 +- public/js/lib/bonfire/bonfire.js | 38 ++++++-------------------------- views/bonfire/bonfire.jade | 1 - 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/app.js b/app.js index 6e8a2909a8..721bbdc9ed 100644 --- a/app.js +++ b/app.js @@ -297,7 +297,7 @@ var passportOptions = { failureRedirect: '/login' }; -app.get('/auth/twitter', passport.authenticate('twitter')); +app.get('/auth/twitter', passport.authorize('twitter')); app.get( '/auth/twitter/callback', passport.authenticate('twitter', { diff --git a/public/js/lib/bonfire/bonfire.js b/public/js/lib/bonfire/bonfire.js index 52f2e1b9dd..2ff6e70a4c 100644 --- a/public/js/lib/bonfire/bonfire.js +++ b/public/js/lib/bonfire/bonfire.js @@ -14,17 +14,6 @@ var submit = function(code) { ); }; -// prepares the string to be printed on the terminal -var escape = function(msg) { - return msg. - replace(/&/g,'&'). - replace(//g,'>'). - replace(/\n/g, '
'). - replace(/ /g, ' '); -}; - - // puts the message on the terminal var print = function(cls, msg) { codeOutput.setValue(msg); @@ -49,17 +38,13 @@ var disconnect = function() { // interface provided to the plugin var api = { output: function(data) { - if (!--requests) { - endLoading(); - } - - // print('separator'); - print('input', data.input); - if (data.error) { - print('message', data.error); - } else { - print('output', data.output); - } + endLoading(); + print('input', data.input); + if (data.error) { + print('message', data.error); + } else { + print('output', data.output); + } } }; @@ -85,15 +70,6 @@ var reset = function() { setTimeout( function() { endLoading(); codeOutput.setValue('Infinite loop detected!'); - - - - - - // print('message', 'Your code took too long to execute. Check for an infinite loop or recursion.'); -// console.log('infinite loop'); - // $('#codeOutput.setValue('Infinite loop detected')') - reset(); }, 10); }); diff --git a/views/bonfire/bonfire.jade b/views/bonfire/bonfire.jade index 86abfe8d02..9f67a474f0 100644 --- a/views/bonfire/bonfire.jade +++ b/views/bonfire/bonfire.jade @@ -44,7 +44,6 @@ block content var editor = myCodeMirror; myCodeMirror.setValue('2*2'); myCodeMirror.setSize("100%", 500); - var codeOutput = CodeMirror.fromTextArea(document.getElementById("codeOutput"), { lineNumbers: false,