From 81364580ed7c54ce6edc84b35dec9307593761a5 Mon Sep 17 00:00:00 2001
From: Julian Lam <julian@designcreateplay.com>
Date: Thu, 25 Apr 2013 14:21:00 -0400
Subject: [PATCH] new 403 page

---
 public/src/app.js           | 8 --------
 public/templates/403.tpl    | 4 ++++
 public/templates/header.tpl | 3 ++-
 src/templates.js            | 2 +-
 src/webserver.js            | 2 +-
 5 files changed, 8 insertions(+), 11 deletions(-)
 create mode 100644 public/templates/403.tpl

diff --git a/public/src/app.js b/public/src/app.js
index 7d64a87537..af93a519c3 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -126,13 +126,5 @@ var socket,
 
 		// Posting
 		jQuery('#post_window').slideToggle(0);
-
-		// Logout
-		logoutEl.addEventListener('click', function() {
-			socket.emit('api:user.logout');
-		});
-		socket.on('api:user.logout', function(data) {
-			if (data.status === 'ok') alert('Logged out.');
-		});
 	})
 }());
diff --git a/public/templates/403.tpl b/public/templates/403.tpl
new file mode 100644
index 0000000000..4cbd7e91dc
--- /dev/null
+++ b/public/templates/403.tpl
@@ -0,0 +1,4 @@
+<div class="alert alert-error">
+	<strong>Access Denied</strong>
+	<p>You seem to have stumbled upon a page that you do not have access to. Perhaps you should <a href="/login">try logging in?</a></p>
+</div>
\ No newline at end of file
diff --git a/public/templates/header.tpl b/public/templates/header.tpl
index ecac91904d..577346b1b1 100644
--- a/public/templates/header.tpl
+++ b/public/templates/header.tpl
@@ -117,7 +117,8 @@
 						<li><a href="/login">Login</a></li>
 					</ul>
 					<ul class="nav pull-right">
-						<li><a href="/logout" id="logout">Log out</a></li>
+						<li><a href="/account">Account</a></li>
+						<li><a href="/logout">Log out</a></li>
 					</ul>
 				</div>
 			</div>
diff --git a/src/templates.js b/src/templates.js
index 4cd4ae86bf..c66932fcff 100644
--- a/src/templates.js
+++ b/src/templates.js
@@ -27,7 +27,7 @@ var fs = require('fs');
 		loadTemplates([
 			'header', 'footer', 'register', 'home',
 			'login', 'reset', 'reset_code', 'account_settings',
-			'logout',
+			'logout', '403',
 			'emails/reset', 'emails/reset_plaintext'
 		]);
 	}
diff --git a/src/webserver.js b/src/webserver.js
index 678ad74b19..7cc898946b 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -93,7 +93,7 @@ var express = require('express'),
 	});
 
 	app.get('/403', function(req, res) {
-		res.send(403, 'You are not authorized to view this page');
+		res.send(templates['header'] + templates['403'] + templates['footer']);
 	});
 
 	module.exports.init = function() {