diff src/routes.coffee @ 8:6fd0a307850f

check empty strings and users
author Mathias Gebbe <mgebbe@intevation.de>
date Wed, 11 Jun 2014 21:58:41 +0200
parents 2123f355ab68
children a52b5b244e51
line wrap: on
line diff
--- a/src/routes.coffee	Wed Jun 11 02:32:53 2014 +0200
+++ b/src/routes.coffee	Wed Jun 11 21:58:41 2014 +0200
@@ -66,7 +66,7 @@
      #  Pump.postUser(result, 'mgebbe@io.intevation.de','Hallo Welt')
 
     #### GOOGLE STUFF ####
-    if not (gpid?) or not (gptoken?)
+    if not (gpid?) or not (gptoken?) or gpid is "" or gptoken is ""
       console.log 'no google'
     else
       async.waterfall [
@@ -93,15 +93,17 @@
  
 
     #### FACEBOOK STUFF ####
-    if not (fbid?) or not (fbtoken?)
+    if not (fbid?) or not (fbtoken?) or fbid is "" or fbtoken is ""
       console.log 'no facebook'
     else
       # get long-lived token
       # (token is callback function)
       # get the long lived token from facebook
       Facebook.getLongLivedToken fbtoken,(token) ->
-        saveUsermap(pumpid,fbid,token,fbtoken, (err, result) ->
-          console.log 'fbsave.')
+        if (token?)
+          saveUsermap(pumpid,fbid,token,fbtoken, (err, result) ->
+            console.log 'fbsave.')
+
     if (fbdelete?)
       console.log "delete fb account"
       async.waterfall [
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)