Decoupled authentication from core and introduced as a plugin

Change-Id: I149e5f7f5ab2d833d812e6e381da8ad4b45c1ed7
diff --git a/templates/layouts/main.html.ep b/templates/layouts/main.html.ep
index 88c364d..1ddb271 100644
--- a/templates/layouts/main.html.ep
+++ b/templates/layouts/main.html.ep
@@ -82,6 +82,6 @@
     % };
     %= notifications 'Kalamar::Plugin::Notifications'
 
+    %= content_block 'scripts'
   </body>
-  %= content_block 'scripts'
 </html>
diff --git a/templates/partial/side.html.ep b/templates/partial/side.html.ep
index 3212adf..d0a5470 100644
--- a/templates/partial/side.html.ep
+++ b/templates/partial/side.html.ep
@@ -1,5 +1,5 @@
 %# # user not logged in
-% if (!stash('documentation') && !$embedded && !user_auth && stash('auth_support')) {
+% if (!stash('documentation') && !$embedded && stash('auth_support') && !$c->auth->token) {
 %   content_for 'sidebar', begin
 %     if (flash('handle_or_email') && !param('handle_or_email')) {
 %       param(handle_or_email => flash('handle_or_email'));