def fb_login(self): fb_token = self.request.params.get('fb_token') if fb_token: user = account.get_from_fb_token(self.request.params.get('fb_token')) if not user: user = account.create_fb(fb_token) id = user['id'] token = auth.issue_token(id) self.request.response.set_cookie('token', token, max_age=365*86400) user['token'] = token return {'user': user.data} else: raise ApiException('missing info')
def fb_login(self): fb_token = self.request.params.get('fb_token') if fb_token: user = account.get_from_fb_token( self.request.params.get('fb_token')) if not user: user = account.create_fb(fb_token) id = user['id'] token = auth.issue_token(id) self.request.response.set_cookie('token', token, max_age=365 * 86400) user['token'] = token return {'user': user.data} else: raise ApiException('missing info')
def create(self): email = self.request.params.get('email') password = self.request.params.get('password') facebook_token = self.request.params.get('fb_token') if facebook_token or (email and password): #create user if email and password: user = account.create(email, password) elif facebook_token: user = account.create_fb(facebook_token) id = user['id'] token = auth.issue_token(id) user['token'] = token self.request.response.set_cookie('token', token, max_age=365*86400) return {'user': user.data} else: raise ApiException('missing info')
def create(self): email = self.request.params.get('email') password = self.request.params.get('password') facebook_token = self.request.params.get('fb_token') if facebook_token or (email and password): #create user if email and password: user = account.create(email, password) elif facebook_token: user = account.create_fb(facebook_token) id = user['id'] token = auth.issue_token(id) user['token'] = token self.request.response.set_cookie('token', token, max_age=365 * 86400) return {'user': user.data} else: raise ApiException('missing info')