Ejemplo n.º 1
0
Archivo: views.py Proyecto: jamslevy/PQ
	def get(self):
		logging.info('Loading Login Response')
		token = self.request.get('token')
		url = 'https://rpxnow.com/api/v2/auth_info'
		args = {
		  'format': 'json',
		  'apiKey': RPX_API_KEY,
		  'token': token
		  }
		r = urlfetch.fetch(url=url,
						   payload=urllib.urlencode(args),
						   method=urlfetch.POST,
						   headers={'Content-Type':'application/x-www-form-urlencoded'}
						   )
		json = simplejson.loads(r.content)
		if self.validate_response(json):
		  if self.session['reset_account']:
		      from accounts.methods import reset_account
		      self.session['user'] = reset_account(self.session['reset_account'], json['profile']['identifier'])
		      self.session['reset_account'] = False
		  else: self.session['user'] = registered(json['profile']['identifier']) # check to see if this_user is registered
		  if self.session['user'] is False: return self.register_user(json) 
		  else: 
		        if not self.session['continue']: self.session['continue'] = '/profile/' + self.session['user'].profile_path 
		        self.redirect(self.session['continue'])
		        self.session['continue'] = False
		return
Ejemplo n.º 2
0
Archivo: views.py Proyecto: jamslevy/PQ
  def dev_login(self):
	if not self.request.get('uid'):
		self.response.out.write('please enter a uid')
		return
	from accounts.methods import registered
	self.session['user'] = False
	self.session['user'] = registered( self.request.get('uid') )
	if self.session['user'] is False: 
	    self.session['unique_identifier'] = self.request.get('uid')
	    return self.redirect('/register')
	return self.redirect('/login')
Ejemplo n.º 3
0
Archivo: views.py Proyecto: jamslevy/PQ
  def get(self):
		
		logging.info('Loading Registration Page')
		self.session['user'] = registered(self.session['unique_identifier']) 
		if self.session['user']: 
		                       logging.warning('user %s attempting to register while signed in', self.session['user'].unique_identifier) 
		                       if not self.session['continue']: self.session['continue'] = '/profile/' + self.session['user'].profile_path 
		                       self.redirect(self.session['continue'])
		                       self.session['continue'] = False
		if not self.session['unique_identifier']: # you should only be visiting this page after a redirect from login page
		     self.redirect('/login')
		     return False
		if self.request.get('nickname'): return self.create_user()
		nickname, email = None, None
		if self.session['nickname']: nickname = self.session['nickname']
		if self.session['email']: email = self.session['email']
		template_values = {'nickname': nickname, 'email': email, 'no_quizlink': True}
		template_values['register_js'] = register_js(template_values)
		path = tpl_path(ACCOUNTS_PATH +'signup.html')
		self.response.out.write(template.render(path, template_values))
		return