From 7bdeefde86669ba77c61f29aafef7dca9b02f61c Mon Sep 17 00:00:00 2001 From: James Burke Date: Fri, 24 Sep 2010 14:28:21 -0700 Subject: [PATCH] Inform user of failure to oauth. --- tasks.txt | 5 ----- web/scripts/oauth.js | 11 +++++++++-- web/send/auth.html | 5 +++-- web/share/accounts.js | 6 ++++-- web/share/index.html | 5 +++++ web/share/index.js | 16 +++++++++++++--- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/tasks.txt b/tasks.txt index 3d4fffc..17e9631 100644 --- a/tasks.txt +++ b/tasks.txt @@ -22,8 +22,6 @@ Tasks: * First experience clicking on the share button -* Make sure name next to tab is not hyperlinked - * If navigate away, first time, shrink the bar, tell them they can click on the share button to bring it back. @@ -34,7 +32,6 @@ Tasks: with new account info, let them know that account changed. * Rewrite retry screen * Rewrite error screen - * If deny facebook, then tell them "You denied it...," * Provide specialized positive feedback on first share * Provide positive feedback experience for every share * Indicate bookmarking is being done, option to opt out. @@ -45,8 +42,6 @@ Tasks: * Load facebook.com: grep for new Presence(\"100000423120383\". A bit brittle. * Both hit the web site, so triggers analytics/facebook may try to sign you into chat? Sound in the background? - * If user clicks add then does deny on oauth window, need to capture the failure and - tell the user about it. * If user clicks remove link, then add, always use OAuth forceLogin, but only for the remove/add case, not for first adds. diff --git a/web/scripts/oauth.js b/web/scripts/oauth.js index 21605d1..96795a0 100644 --- a/web/scripts/oauth.js +++ b/web/scripts/oauth.js @@ -34,9 +34,16 @@ function () { //Handle communication from the auth window, when it completes. window.addEventListener("message", function (evt) { //TODO: ideally lock down the domain check on evt.origin. - if (evt.data === 'authDone') { + var status = evt.data; + if (status) { + if (status === 'oauth_success') { + status = true; + } else { + status = false; + } + if (authDone) { - authDone(); + authDone(status); authDone = null; } } diff --git a/web/send/auth.html b/web/send/auth.html index 799735c..fcef952 100644 --- a/web/send/auth.html +++ b/web/send/auth.html @@ -18,10 +18,11 @@ require(["require", "jquery", "blade/url"], function (require, $, url) { var target = window.location.href.split('#')[1]; - if (target) { + if (target && (target === 'oauth_success' || target === 'oauth_failure')) { + //TODO: ideally lock down the domain be location.hostname, but //a problem for 127 addresses? - window.opener.postMessage('authDone', '*'); + window.opener.postMessage(target, '*'); window.close(); } var search = window.location.href.split('?')[1]; diff --git a/web/share/accounts.js b/web/share/accounts.js index 5e76a69..d41c54a 100644 --- a/web/share/accounts.js +++ b/web/share/accounts.js @@ -142,8 +142,10 @@ function (require, $, fn, rdapi, oauth, jig) { .delegate('.connectButton', 'click', function (evt) { var buttonNode = evt.target, domain = buttonNode.getAttribute('data-domain'); - oauth(domain, function () { - location.reload(); + oauth(domain, function (success) { + if (success) { + location.reload(); + } }); }) .delegate('.disconnectButton', 'click', function (evt) { diff --git a/web/share/index.html b/web/share/index.html index fe62d37..65fa257 100644 --- a/web/share/index.html +++ b/web/share/index.html @@ -173,6 +173,11 @@ + +