diff --git a/public/index.html b/public/index.html
index ae3792271..b928e6a6f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -32,7 +32,6 @@
diff --git a/public/red/main.js b/public/red/main.js
index 809f2feb7..9e45c3ce8 100644
--- a/public/red/main.js
+++ b/public/red/main.js
@@ -171,46 +171,8 @@ var RED = (function() {
]
});
- if (RED.settings.user) {
- RED.menu.init({id:"btn-usermenu",
- options: []
- });
-
- var updateUserMenu = function() {
- $("#btn-usermenu-submenu li").remove();
- if (RED.settings.user.anonymous) {
- RED.menu.addItem("btn-usermenu",{
- id:"btn-login",
- label:"Login",
- onselect: function() {
- RED.user.login({cancelable:true},function() {
- RED.settings.load(function() {
- RED.notify("Logged in as "+RED.settings.user.username,"success");
- updateUserMenu();
- });
- });
- }
- });
- } else {
- RED.menu.addItem("btn-usermenu",{
- id:"btn-username",
- label:""+RED.settings.user.username+""
- });
- RED.menu.addItem("btn-usermenu",{
- id:"btn-logout",
- label:"Logout",
- onselect: function() {
- RED.user.logout();
- }
- });
- }
-
- }
- updateUserMenu();
- } else {
- $("#btn-usermenu").parent().hide();
- }
-
+ RED.user.init();
+
RED.library.init();
RED.palette.init();
RED.sidebar.init();
diff --git a/public/red/user.js b/public/red/user.js
index 978627551..4476de691 100644
--- a/public/red/user.js
+++ b/public/red/user.js
@@ -1,5 +1,5 @@
/**
- * Copyright 2014 IBM Corp.
+ * Copyright 2014, 2015 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,7 +109,53 @@ RED.user = (function() {
})
}
+ function updateUserMenu() {
+ $("#btn-usermenu-submenu li").remove();
+ if (RED.settings.user.anonymous) {
+ RED.menu.addItem("btn-usermenu",{
+ id:"btn-login",
+ label:"Login",
+ onselect: function() {
+ RED.user.login({cancelable:true},function() {
+ RED.settings.load(function() {
+ RED.notify("Logged in as "+RED.settings.user.username,"success");
+ updateUserMenu();
+ });
+ });
+ }
+ });
+ } else {
+ RED.menu.addItem("btn-usermenu",{
+ id:"btn-username",
+ label:""+RED.settings.user.username+""
+ });
+ RED.menu.addItem("btn-usermenu",{
+ id:"btn-logout",
+ label:"Logout",
+ onselect: function() {
+ RED.user.logout();
+ }
+ });
+ }
+
+ }
+
+
+
+ function init() {
+ if (RED.settings.user) {
+ $('')
+ .prependTo(".header-toolbar");
+
+ RED.menu.init({id:"btn-usermenu",
+ options: []
+ });
+ updateUserMenu();
+ }
+
+ }
return {
+ init: init,
login: login,
logout: logout
}