From 9a1b3c9548e00a88c963c83132fd9fa4e5af69d6 Mon Sep 17 00:00:00 2001 From: Simon Eisenmann Date: Mon, 28 Apr 2014 00:10:38 +0200 Subject: [PATCH] Only show logout and warning if there is something stored. --- static/js/controllers/mediastreamcontroller.js | 1 + static/js/directives/settings.js | 2 ++ static/partials/settings.html | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/static/js/controllers/mediastreamcontroller.js b/static/js/controllers/mediastreamcontroller.js index f90dd9f4..277ab654 100644 --- a/static/js/controllers/mediastreamcontroller.js +++ b/static/js/controllers/mediastreamcontroller.js @@ -394,6 +394,7 @@ define(['underscore', 'bigscreen', 'moment', 'sjcl', 'webrtc.adapter'], function // Check if we can load a user. var login = mediaStream.users.load(); if (login !== null) { + $scope.loadedUserlogin = true; console.log("Trying to authorize with stored credentials ..."); mediaStream.users.authorize(login, function(data) { console.info("Retrieved nonce - authenticating as user:", data.userid); diff --git a/static/js/directives/settings.js b/static/js/directives/settings.js index 92b2c504..3d8cb4b5 100644 --- a/static/js/directives/settings.js +++ b/static/js/directives/settings.js @@ -135,6 +135,8 @@ define(['underscore', 'text!partials/settings.html'], function(_, template) { if (data.nonce) { // If the server provided us a nonce, we can do everthing on our own. mediaStream.users.store(data); + $scope.loadedUserlogin = true; + safeApply($scope); // Directly authenticate ourselves with the provided nonce. mediaStream.api.requestAuthentication(data.userid, data.nonce); delete data.nonce; diff --git a/static/partials/settings.html b/static/partials/settings.html index a5691973..05f7f55c 100644 --- a/static/partials/settings.html +++ b/static/partials/settings.html @@ -34,7 +34,7 @@ {{_('Only register an ID if this is your private browser.')}}
{{userid}}
-