Inform user of failure to oauth.

This commit is contained in:
James Burke 2010-09-24 14:28:21 -07:00
Родитель fcb7c88bab
Коммит 7bdeefde86
6 изменённых файлов: 34 добавлений и 14 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -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];

Просмотреть файл

@ -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) {

Просмотреть файл

@ -173,6 +173,11 @@
<button id="statusAuthButton" class="statusButton">Cancel</button>
</div>
<div id="statusOAuthFailed" class="status hidden">
Could not connect to your account. Please try again.
<button id="statusErrorButton" class="statusButton">OK</button>
</div>
<div id="statusError" class="status hidden">
Linkdrop just vomited. <span id="statusErrorMessage"></span>
<button id="statusErrorButton" class="statusButton">OK</button>

Просмотреть файл

@ -452,7 +452,13 @@ function (require, $, fn, rdapi, oauth, jig, url,
cancelStatus();
});
$('#authOkButton').click(function (evt) {
oauth(sendData.domain, sendMessage);
oauth(sendData.domain, function (success) {
if (success) {
sendMessage();
} else {
showStatus('statusOAuthFailed');
}
});
});
//Set up tabs.
@ -547,8 +553,12 @@ function (require, $, fn, rdapi, oauth, jig, url,
var node = evt.target,
domain = node.getAttribute('data-domain');
oauth(domain, function () {
accountsUpdated();
oauth(domain, function (success) {
if (success) {
accountsUpdated();
} else {
showStatus('statusOAuthFailed');
}
});
});