BugzIO / SprintRPC

@k88hudson's bugzilla app `sprinter` made to work with Bugzilla's JSONRPC instead of REST
0 stars 2 forks source link

Broken angular config CSRF's return blank pages. #35

Closed sudheesh001 closed 9 years ago

sudheesh001 commented 9 years ago

Emergency fix keeping in track the OAuth removal. This wasn't visible until the complete restart of the servers. Looks like the config variables which were removes were left hanging somewhere and was being used.

sudheesh001 commented 9 years ago

If the config problem is fixed, there's a problem with the POST request being made during addition of a sprint.

I think its best to revert the previous commit. I am unable to figure out why the same error crops up even at this commit b004ff7bb80d6a49900246bca6e3ed5c172a763e There was nothing much to break the code in that commit.

debloper commented 9 years ago

@sudheesh001 this spawned from #32: removal of .env without removing the traces & calls to it. Following patch fixes that.

Please read this carefully, apply this, test the setup & send PR. While you're at it, also update the Readme file with removing the 1st setup step, and the configuration section.

diff --git a/app/js/app.js b/app/js/app.js
index e4494aa..4d6785f 100644
--- a/app/js/app.js
+++ b/app/js/app.js
@@ -81,9 +81,6 @@ angular.module('myApp', [
       });

       $rootScope.canEdit = function canEdit(user) {
-        if (config.dev) {
-          return true;
-        }
         if (!user) {
           return false;
         }
diff --git a/app/js/services.js b/app/js/services.js
index cba3642..ec7a6cb 100644
--- a/app/js/services.js
+++ b/app/js/services.js
@@ -29,8 +29,7 @@ angular.module('myApp.services', ['ngResource'])
         });
       };
       service.newBugUrl = function (whiteboard, defaultComponent) {
-        var link = 'https://bugzilla.redhat.com/enter_bug.cgi?product=' + config.bzProduct +
-        '&status_whiteboard=' + encodeURIComponent(whiteboard);
+        var link = 'https://bugzilla.redhat.com/enter_bug.cgi?status_whiteboard=' + encodeURIComponent(whiteboard);

         if (defaultComponent) {
           link += ('&component=' + encodeURIComponent(defaultComponent));
diff --git a/server/app.js b/server/app.js
index 0ee89e4..0fd3a02 100644
--- a/server/app.js
+++ b/server/app.js
@@ -5,11 +5,6 @@ Habitat.load();
 // Configuration
 var env = new Habitat();

-// Heroku clearbase support
-if (!env.get('DB_CONNECTIONSTRING') && env.get('cleardbDatabaseUrl')) {
-  env.set('DB_CONNECTIONSTRING', env.get('cleardbDatabaseUrl').replace('?reconnect=true', ''));
-}
-
 // App
 var app = require('./server')(env);

diff --git a/server/routes/index.js b/server/routes/index.js
index fecc3f3..b572e99 100644
--- a/server/routes/index.js
+++ b/server/routes/index.js
@@ -10,11 +10,8 @@ module.exports = function(env, app, dbInit, bugzilla, authUri) {

   // Serve up virtual configuration "file"
   app.get('/config.js', function (req, res) {
-    var config = env.get('ANGULAR');
-
+    var config = {};
     config.csrf = req.csrfToken();
-    config.bzProduct = env.get('BZ_PRODUCT');
-    config.dev = env.get('DEV');

     res.type('js');
     res.send('window.angularConfig = ' + JSON.stringify(config) + ';');
sudheesh001 commented 9 years ago

Good to close. Fixed on commit 48b23888b09bdde17a80e03812f255001c8d4796