comparison 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
comparison
equal deleted inserted replaced
7:2123f355ab68 8:6fd0a307850f
64 # searchUsermap(bridgeid,bridgeid, callback) 64 # searchUsermap(bridgeid,bridgeid, callback)
65 #], (result) -> 65 #], (result) ->
66 # Pump.postUser(result, 'mgebbe@io.intevation.de','Hallo Welt') 66 # Pump.postUser(result, 'mgebbe@io.intevation.de','Hallo Welt')
67 67
68 #### GOOGLE STUFF #### 68 #### GOOGLE STUFF ####
69 if not (gpid?) or not (gptoken?) 69 if not (gpid?) or not (gptoken?) or gpid is "" or gptoken is ""
70 console.log 'no google' 70 console.log 'no google'
71 else 71 else
72 async.waterfall [ 72 async.waterfall [
73 (callback) -> 73 (callback) ->
74 saveUsermap(pumpid,gpid,gptoken,'', callback) 74 saveUsermap(pumpid,gpid,gptoken,'', callback)
91 return 91 return
92 ], (err, result) -> 92 ], (err, result) ->
93 93
94 94
95 #### FACEBOOK STUFF #### 95 #### FACEBOOK STUFF ####
96 if not (fbid?) or not (fbtoken?) 96 if not (fbid?) or not (fbtoken?) or fbid is "" or fbtoken is ""
97 console.log 'no facebook' 97 console.log 'no facebook'
98 else 98 else
99 # get long-lived token 99 # get long-lived token
100 # (token is callback function) 100 # (token is callback function)
101 # get the long lived token from facebook 101 # get the long lived token from facebook
102 Facebook.getLongLivedToken fbtoken,(token) -> 102 Facebook.getLongLivedToken fbtoken,(token) ->
103 saveUsermap(pumpid,fbid,token,fbtoken, (err, result) -> 103 if (token?)
104 console.log 'fbsave.') 104 saveUsermap(pumpid,fbid,token,fbtoken, (err, result) ->
105 console.log 'fbsave.')
106
105 if (fbdelete?) 107 if (fbdelete?)
106 console.log "delete fb account" 108 console.log "delete fb account"
107 async.waterfall [ 109 async.waterfall [
108 (callback) -> 110 (callback) ->
109 Usermap.search {user_pumpio: fbdelete}, callback 111 Usermap.search {user_pumpio: fbdelete}, callback
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)