Example #1
0
 def twitter_login(self):
     redirect_url, tokens = twitter.start_oauth(
         'http://localhost:8000/twitter_oauth')
     get_session()['twitter_request_token'] = tokens
     self.twitter_session = get_session(
     )['twitter_request_token']  #workaround for disappearing session key 2.8.2013 Rod Shapeley
     return view.redirect(redirect_url)
Example #2
0
 def oauth2callback(self, error=False, **kwargs):
     if error:
         return error
     oauth = get_session()['gplus_oauth']
     oauth.get_credentials(**kwargs)
     get_session()['person'] = oauth.get_person()
     return view.redirect('/')
Example #3
0
 def signout(self):
     'remove the user info from this session'
     try:
         del cherrypy.session['person']
     except KeyError:
         pass
     return view.redirect('/')
Example #4
0
File: web.py Project: darius/spnet
 def oauth2callback(self, error=False, **kwargs):
     if error:
         return error
     oauth = get_session()['gplus_oauth']
     oauth.get_credentials(**kwargs)
     get_session()['person'] = oauth.get_person()
     return view.redirect('/')
Example #5
0
 def oauth2callback(self, error=False, **kwargs):
     if error:
         return error
     oauth = cherrypy.session['gplus_oauth']
     oauth.get_credentials(**kwargs)
     self.gplus_oauth = oauth # just for hand testing
     cherrypy.session['person'] = oauth.get_person()
     return view.redirect('/')
Example #6
0
 def login(self, email, password):
     'check password and create session if authenticated'
     try:
         a = core.EmailAddress(email)
     except KeyError:
         return 'no such email address'
     p = a.parent
     if p.authenticate(password):
         get_session()['email'] = email
         get_session()['person'] = p
     else:
         return 'bad password'
     return view.redirect('/view?view=person&person=' + str(p._id))
Example #7
0
 def oauth2callback(self, error=False, **kwargs):
     if error:
         return error
     try:
         oauth = get_session()['gplus_oauth']
     except KeyError:
         return view.report_error('session storage failed', 403,
                                  '''Login session info storage (cookie)
     failed.  Please make sure that your browser accepts cookies
     from selectedpapers.net. ''', traceback=False)
     oauth.get_credentials(**kwargs)
     get_session()['person'] = oauth.get_person()
     return view.redirect('/')
Example #8
0
 def login(self, email, password):
     'check password and create session if authenticated'
     try:
         a = core.EmailAddress(email)
     except KeyError:
         return 'no such email address'
     p = a.parent
     if p.authenticate(password):
         get_session()['email'] = email
         get_session()['person'] = p
     else:
         return 'bad password'
     return view.redirect('/view?view=person&person=' + str(p._id))
Example #9
0
 def twitter_oauth(self, oauth_token, oauth_verifier):
     t = self.twitter_session
     auth = twitter.complete_oauth(
         t[0], t[1],
         oauth_verifier)  #now up to here 7:54pm 2.8.2013 Rod Shapeley
     #print "no problems so far"
     p, user, api = twitter.get_auth_person(
         auth)  #now up to here 7:58pm 2.8.2013 Rod Shapeley
     get_session(
     )['twitter_oauth'] = auth  # workaround - extract p, user, api from auth. 7.8.2013 Rod Shapeley
     self.twitter_auth = auth  # just for hand testing
     # pickling error http://docs.python.org/2/library/pickle.html#what-can-be-pickled-and-unpickled
     # therefore will need to rewrite previous functions (oauth_twitter) as a class twitter.Oauth
     # in order that it can be pickled.  at least, that's a good start. 8:26pm 2.8.2013 Rod Shapeley
     #the problem is not with twitter.complete_oauth, twitter.start_oauth.  No, the problem is with
     #twitter.get_auth_person(auth) .... this is where the problem lies.
     #no, not even there.  looks like it is in assignation of get_session()['person'] = p.
     #return 'Logged in to twitter'
     print 'Logged in to twitter'
     return view.redirect(
         'http://localhost:8000')  #might need to be changed in production
Example #10
0
 def post_html(self, interest, **kwargs):
     'display interest change by re-displaying the paper page'
     return view.redirect(interest.parent.get_value('local_url'))
Example #11
0
 def signout(self):
     'force this session to expire immediately'
     cherrypy.lib.sessions.expire()
     return view.redirect('/')
Example #12
0
 def gplus_login(self):
     oauth = gplus.OAuth(keys=self.gplus_keys)
     get_session()['gplus_oauth'] = oauth
     return view.redirect(oauth.get_authorize_url())
Example #13
0
 def twitter_login(self):
     redirect_url, tokens = twitter.start_oauth('http://localhost:8000/twitter_oauth')
     get_session()['twitter_request_token'] = tokens
     return view.redirect(redirect_url)
Example #14
0
 def __call__(self):
     return view.redirect(self.content)
Example #15
0
 def signout(self):
     'force this session to expire immediately'
     cherrypy.lib.sessions.expire()
     return view.redirect('/')
Example #16
0
 def __call__(self):
     return view.redirect(self.content)
Example #17
0
 def post_html(self, interest, **kwargs):
     'display interest change by re-displaying the paper page'
     return view.redirect(interest.parent.get_value('local_url'))
Example #18
0
 def gplus_login(self):
     oauth = gplus.OAuth(keys=self.gplus_keys)
     get_session()['gplus_oauth'] = oauth
     return view.redirect(oauth.get_authorize_url())