[hub] Published Products Page
diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.json b/erpnext/hub_node/doctype/hub_settings/hub_settings.json
index 61ef48c..a5338e9 100644
--- a/erpnext/hub_node/doctype/hub_settings/hub_settings.json
+++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.json
@@ -180,6 +180,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "site_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Site Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "country", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -643,7 +675,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-07-26 15:56:36.104768", 
+ "modified": "2018-07-28 00:48:21.210413", 
  "modified_by": "cave@aperture.com", 
  "module": "Hub Node", 
  "name": "Hub Settings", 
diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.py b/erpnext/hub_node/doctype/hub_settings/hub_settings.py
index 621229c..0b7dc48 100644
--- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py
+++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.py
@@ -15,24 +15,13 @@
 # hub_url = "http://erpnext.hub:8001"
 hub_url = "http://hub.market:8000"
 
-class OAuth2Session():
-	def __init__(self, headers):
-		self.headers = headers
-	def get(self, url, params, headers, verify):
-		res = requests.get(url, params=params, headers=self.headers, verify=verify)
-		return res
-	def post(self, url, data, verify):
-		res = requests.post(url, data=data, headers=self.headers, verify=verify)
-		return res
-	def put(self, url, data, verify):
-		res = requests.put(url, data=data, headers=self.headers, verify=verify)
-		return res
-
 class HubSetupError(frappe.ValidationError): pass
 
 class HubSettings(Document):
 
 	def validate(self):
+		protocol = 'http://'
+		self.site_name = protocol + frappe.local.site + ':' + str(frappe.conf.webserver_port)
 		if self.publish_pricing and not self.selling_price_list:
 			frappe.throw(_("Please select a Price List to publish pricing"))
 
@@ -53,35 +42,13 @@
 		doc.run()
 		# self.sync_in_progress = 0
 
-	def pre_reg(self):
-		site_name = frappe.local.site + ':' + str(frappe.conf.webserver_port)
-		protocol = 'http://'
-		route = '/token'
-		data = {
-			'site_name': site_name,
-			'protocol': protocol,
-			'route': route
-		}
-
-		redirect_url = protocol + site_name + route
-		post_url = hub_url + '/api/method/hub.hub.api.pre_reg'
-
-		response = requests.post(post_url, data=data)
-		response.raise_for_status()
-		message = response.json().get('message')
-
-		if message and message.get('client_id'):
-			print("======CLIENT_ID======")
-			print(message.get('client_id'))
-
-			return {
-				'client_id': message.get('client_id'),
-				'redirect_uri': redirect_url
-			}
-
-
 	def register(self):
 		""" Create a User on hub.erpnext.org and return username/password """
+
+		# TODO: site_name for cloud sites
+		protocol = 'http://'
+		self.site_name = protocol + frappe.local.site + ':' + str(frappe.conf.webserver_port)
+
 		data = {
 			'profile': self.as_json()
 		}
@@ -103,18 +70,18 @@
 
 		return message or None
 
-	def unregister(self):
-		""" Disable the User on hub.erpnext.org"""
+	# def unregister(self):
+	# 	""" Disable the User on hub.erpnext.org"""
 
-		hub_connector = frappe.get_doc(
-			'Data Migration Connector', 'Hub Connector')
+	# 	hub_connector = frappe.get_doc(
+	# 		'Data Migration Connector', 'Hub Connector')
 
-		connection = hub_connector.get_connection()
-		response_doc = connection.update('User', frappe._dict({'enabled': 0}), hub_connector.username)
+	# 	connection = hub_connector.get_connection()
+	# 	response_doc = connection.update('User', frappe._dict({'enabled': 0}), hub_connector.username)
 
-		if response_doc['enabled'] == 0:
-			self.enabled = 0
-			self.save()
+	# 	if response_doc['enabled'] == 0:
+	# 		self.enabled = 0
+	# 		self.save()
 
 	def create_hub_connector(self, message):
 		if frappe.db.exists('Data Migration Connector', 'Hub Connector'):
diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js
index cb879eb..7363afb 100644
--- a/erpnext/public/js/hub/marketplace.js
+++ b/erpnext/public/js/hub/marketplace.js
@@ -8,7 +8,7 @@
 
 		frappe.db.get_doc('Hub Settings')
 			.then(doc => {
-				this.hub_settings = doc;
+				hub.settings = doc;
 				this.registered = doc.registered;
 
 				this.setup_header();
@@ -158,14 +158,15 @@
 		}
 
 		if (route[1] === 'profile' && !this.subpages.profile) {
-			this.subpages.profile = new erpnext.hub.Profile(this.$body, {data: this.hub_settings});
+			this.subpages.profile = new erpnext.hub.Profile(this.$body);
 		}
 
 		if (route[1] === 'publish' && !this.subpages.publish) {
-			this.subpages.publish = new erpnext.hub.Publish(
-				this.$body,
-				{sync_in_progress: this.hub_settings.sync_in_progress}
-			);
+			this.subpages.publish = new erpnext.hub.Publish(this.$body);
+		}
+
+		if (route[1] === 'my-products' && !this.subpages['my-products']) {
+			this.subpages['my-products'] = new erpnext.hub.PublishedProducts(this.$body);
 		}
 
 		if (!Object.keys(this.subpages).includes(route[1])) {
@@ -650,13 +651,12 @@
 }
 
 erpnext.hub.Profile = class Profile extends SubPage {
-	constructor(parent, profile_data) {
-		super(parent);
-		this.profile_data = profile_data;
-	}
-
 	make_wrapper() {
 		super.make_wrapper();
+
+		// Shorthand for profile data;
+		const p = hub.settings;
+
 		const profile_html = `<div class="hub-item-container">
 			<div class="row visible-xs">
 				<div class="col-xs-12 margin-bottom">
@@ -696,21 +696,16 @@
 }
 
 erpnext.hub.Publish = class Publish extends SubPage {
-	make_wrapper(options) {
-		super.make_wrapper();
-		this.sync_in_progress = options.sync_in_progress;
-
-		this.load_publish_page();
-	}
-
 	load_publish_page() {
 		const title_html = `<b>${__('Select Products to Publish')}</b>`;
+
 		const info = `<p class="text-muted">${__("Status decided by the 'Publish in Hub' field in Item.")}</p>`;
-		const subtitle_html = `
-		<p class="text-muted">
+
+		const subtitle_html = `<p class="text-muted">
 			${__(`Only products with an image, description and category can be published.
 			Please update them if an item in your inventory does not appear.`)}
 		</p>`;
+
 		const publish_button_html = `<button class="btn btn-primary btn-sm publish-items">
 			<i class="visible-xs octicon octicon-check"></i>
 			<span class="hidden-xs">Publish</span>
@@ -761,7 +756,7 @@
 	}
 
 	get_items_and_render() {
-		if(this.sync_in_progress) {
+		if(hub.settings.sync_in_progress) {
 			this.load_publishing_state();
 			return;
 		}
@@ -823,6 +818,27 @@
 	}
 }
 
+erpnext.hub.PublishedProducts = class PublishedProducts extends SubPage {
+	get_items_and_render() {
+		this.$wrapper.find('.hub-card-container').empty();
+		this.get_published_products()
+			.then(items => this.render(items));
+	}
+
+	refresh() {
+		this.get_items_and_render();
+	}
+
+	render(items) {
+		const items_container = $(get_item_card_container_html(items, __('Your Published Products')));
+		this.$wrapper.append(items_container);
+	}
+
+	get_published_products() {
+		return hub.call('get_items_by_seller', { hub_seller: hub.settings.company_email });
+	}
+}
+
 erpnext.hub.NotFound = class NotFound extends SubPage {
 	refresh() {
 		this.$wrapper.html(get_empty_state(
@@ -955,9 +971,11 @@
 		}
 
 		// cache invalidation after 5 minutes
+		const timeout = 5 * 60 * 1000;
+
 		setTimeout(() => {
 			delete erpnext.hub.cache[key];
-		}, 5 * 60 * 1000);
+		}, timeout);
 
 		frappe.call({
 			method: 'erpnext.hub_node.call_hub_method',