def _on_auth(self, facebook): if not facebook: raise tornado.web.HTTPError(500, "Facebook auth failed") facebook_key = "%s%s" % ('facebook:', facebook['uid']) username = r.get(facebook_key) facebook_info_key = "%s%s" % (username, ':facebook') if username: self.set_secure_cookie("user", username) r.set(facebook_info_key, encode(facebook)) self.redirect("/") else: self.set_secure_cookie("facebook", encode(facebook)) self.redirect("/create")
def _on_auth(self, twitter): if not twitter: raise tornado.web.HTTPError(500, "Twitter auth failed") twitter_key = "%s%s" % ('twitter:', twitter['access_token']['user_id']) username = r.get(twitter_key) # see if we have a user with that twitter id twitter_info_key = "%s%s" % (username, ':twitter') if username: self.set_secure_cookie("user", username) # write the lates information to redis r.set(twitter_info_key, encode(twitter)) self.redirect("/") else: self.set_secure_cookie("twitter", encode(twitter)) self.redirect("/create")
def get(self, identifier): res = {} res['advertisers'] = yield redis.async.hgetall('advertisers_' + identifier) res['patrons'] = yield redis.async.hgetall('patrons_' + identifier) res['messages'] = yield redis.async.hgetall('messages_' + identifier) res['notifications'] = yield redis.async.hgetall('notifications_' + identifier) self.write(encode(res)) self.finish()
def _on_auth(self, google): if not google: raise tornado.web.HTTPError(500, "Google auth failed") google_key = "%s%s" % ('google:', google['email']) username = r.get(google_key) google_info_key = "%s%s" % (username, ':google') if username: self.set_secure_cookie("user", username) r.set(google_info_key, encode(google)) self.redirect("/") else: self.set_secure_cookie("google", tornado.escape.json_encode(google)) self.redirect("/create")
def set_name(self, **kwargs): '''Takes a kwargs and updates the group information with them''' return r.set(self.rname, encode(kwargs))