浏览代码

Fix Auth token

Gaël Métais 10 年之前
父节点
当前提交
84faabca86
共有 3 个文件被更改,包括 6 次插入6 次删除
  1. 1 1
      lib/server/authMiddleware.js
  2. 2 2
      lib/tools/phantomasWrapper.js
  3. 3 3
      test/api/apiTest.js

+ 1 - 1
lib/server/authMiddleware.js

@@ -36,7 +36,7 @@ function isTokenValid(token) {
     var data = null;
     var data = null;
 
 
     try {
     try {
-        jwt.decode(token, config.tokenSalt);
+        data = jwt.decode(token, config.tokenSalt);
     } catch(err) {
     } catch(err) {
         debug('Error while decoding token');
         debug('Error while decoding token');
         debug(err);
         debug(err);

+ 2 - 2
lib/tools/phantomasWrapper.js

@@ -58,10 +58,10 @@ var PhantomasWrapper = function() {
 
 
         // Kill the application if nothing happens for 10 minutes
         // Kill the application if nothing happens for 10 minutes
         var killer = setTimeout(function() {
         var killer = setTimeout(function() {
-            debug('Killing the app because the test on ' + task.url + ' was launched 10 minutes ago');
+            debug('Killing the app because the test on %s was launched %d seconds ago', task.url, 3*options.timeout);
             // If in server mode, forever will restart the server
             // If in server mode, forever will restart the server
             process.exit(1);
             process.exit(1);
-        }, 600000);
+        }, 3*options.timeout*60*1000);
 
 
         // It's time to launch the test!!!
         // It's time to launch the test!!!
         var triesNumber = 2;
         var triesNumber = 2;

+ 3 - 3
test/api/apiTest.js

@@ -4,10 +4,10 @@ var jwt         = require('jwt-simple');
 
 
 var config = {
 var config = {
     "authorizedKeys": {
     "authorizedKeys": {
-        "1234567890": "test@test.com"
+        "1234567890": "contact@gaelmetais.com"
     },
     },
-    "tokenSalt": "test-salt",
-    "authorizedApplications": ["wooot"]
+    "tokenSalt": "lake-city",
+    "authorizedApplications": ["frontend"]
 };
 };
 
 
 var apiUrl = 'http://localhost:8387/api';
 var apiUrl = 'http://localhost:8387/api';