Example #1
0
	def post(self):
		user_email = self.request.get("email")
		user_country = self.request.get("country")
		
		user_email_ok = User.validate_email(user_email)
		user_country_ok = User.validate_country(user_country)
			
		if user_email_ok and user_country_ok:			
			user = self.current_user
			user.email = user_email
			user.country = user_country
			user.put()	
			
			# Redirect users to the page they came from or the page they're supposed to head to
			next = self.session.get("next")
			redirect = self.session.get("referer")
			if next:
				redirect = next

			self.redirect(str(redirect))
		else:
			# Display the form again
			values = {
				"countries": User.get_countries(),
			}
			path = "complete.html"
			self.render(path, values)
Example #2
0
	def post(self):
		user_email = self.request.get("email")
		user_country = self.request.get("country")

		user = self.current_user

		if User.validate_email(user_email):
			user.email = user_email

		if User.validate_country(user_country):
			user.country = user_country

		email_idea_comment = False
		email_idea_feedback = False
		email_comment_reply = False
		
		if self.request.get("idea-comment"):
			email_idea_comment = True
		if self.request.get("idea-feedback"):			
			email_idea_feedback = True
		if self.request.get("comment-reply"):			
			email_comment_reply = True
				
		user.email_idea_comment = email_idea_comment
		user.email_idea_feedback = email_idea_feedback
		user.email_comment_reply = email_comment_reply
		user.put()
		
		values = {
			"response": "Settings updated",
			"next":{
				"content": "Back to my profile",
				"url": "/"+user.username,
			}
		}
		path = "feedback.html"
		self.render(path, values)