diff options
author | jamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-07 19:50:45 +0000 |
---|---|---|
committer | jamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-07 19:50:45 +0000 |
commit | d5aa59a21f2d9ef9cd66e548f3885605ba9982a2 (patch) | |
tree | 4e48a659d006595b1403b27117d64e33c6792e41 /remoting | |
parent | e32abeaae7a8b5eaa3c6dc5b9076dc13ff0a10ad (diff) | |
download | chromium_src-d5aa59a21f2d9ef9cd66e548f3885605ba9982a2.zip chromium_src-d5aa59a21f2d9ef9cd66e548f3885605ba9982a2.tar.gz chromium_src-d5aa59a21f2d9ef9cd66e548f3885605ba9982a2.tar.bz2 |
Handle errors when fetching email address.
BUG=126309
TEST=Manual
Review URL: https://chromiumcodereview.appspot.com/10383026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/webapp/main.html | 4 | ||||
-rw-r--r-- | remoting/webapp/oauth2.js | 5 | ||||
-rw-r--r-- | remoting/webapp/remoting.js | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/remoting/webapp/main.html b/remoting/webapp/main.html index 155ddd3..e52eaa7 100644 --- a/remoting/webapp/main.html +++ b/remoting/webapp/main.html @@ -290,7 +290,9 @@ found in the LICENSE file. data-ui-mode="home.auth" class="kd-modaldialog"> <h2 i18n-content="MODE_AUTHORIZE"></h2> - <p i18n-content="DESCRIPTION_AUTHORIZE" class="message"></p> + <p id="auth-error-message" + i18n-content="DESCRIPTION_AUTHORIZE" + class="message"></p> <div class="centered"> <button id="auth-button" type="button" diff --git a/remoting/webapp/oauth2.js b/remoting/webapp/oauth2.js index 3867698..6f74cbe 100644 --- a/remoting/webapp/oauth2.js +++ b/remoting/webapp/oauth2.js @@ -383,8 +383,10 @@ remoting.OAuth2.prototype.getEmail = function(setEmail) { if (xhr.status == 200) { // TODO(ajwong): See if we can't find a JSON endpoint. that.email = xhr.responseText.split('&')[0].split('=')[1]; + window.localStorage.setItem(that.KEY_EMAIL_, that.email); + } else { + console.error('Unable to get email address:', xhr.status, xhr); } - window.localStorage.setItem(that.KEY_EMAIL_, that.email); setEmail(that.email); }; @@ -396,6 +398,7 @@ remoting.OAuth2.prototype.getEmail = function(setEmail) { remoting.xhr.get('https://www.googleapis.com/userinfo/email', onResponse, '', headers); } else { + console.error('Unable to get email address: no access token'); setEmail(null); } }; diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js index a51407e..62d1618 100644 --- a/remoting/webapp/remoting.js +++ b/remoting/webapp/remoting.js @@ -231,8 +231,10 @@ function setEmail_(email) { if (email) { document.getElementById('current-email').innerText = email; } else { - // TODO(ajwong): Have a better way of showing an error. - document.getElementById('current-email').innerText = '???'; + var e = document.getElementById('auth-error-message'); + e.innerText = chrome.i18n.getMessage(remoting.Error.SERVICE_UNAVAILABLE); + e.classList.add('error-state'); + remoting.setMode(remoting.AppMode.UNAUTHENTICATED); } } |