Make sure reauth flow of saving data and recovering to do a share happens in both cases where auth info is lost: either cookies are lost or the client has out of date account info.
This commit is contained in:
Родитель
c1937ff8d9
Коммит
f29f5ca736
|
@ -239,11 +239,6 @@
|
|||
<img src="i/loader.gif"> sharing...
|
||||
</div>
|
||||
|
||||
<div id="statusAuth" class="status hidden error">
|
||||
Sorry, you need to authenticate before we continue.
|
||||
<button class="statusButton statusErrorButton">ok</button>
|
||||
</div>
|
||||
|
||||
<div id="statusOAuthFailed" class="status hidden error">
|
||||
Sorry, we couldn't connect to your account. Please try again.
|
||||
<button class="statusButton statusErrorButton">ok</button>
|
||||
|
@ -278,7 +273,7 @@
|
|||
<button id="statusServerErrorButton" class="statusButton statusErrorCloseButton">ok</button>
|
||||
</div>
|
||||
|
||||
<div id="statusCookiePukeError" class="status hidden intermediate error">
|
||||
<div id="statusAuth" class="status hidden intermediate error">
|
||||
Sorry, you've been signed out. Sign in again to finish sharing.
|
||||
<button id="authOkButton" class="statusButton">sign in</button>
|
||||
</div>
|
||||
|
|
|
@ -306,6 +306,18 @@ function (require, $, fn, rdapi, oauth, jig, url,
|
|||
}
|
||||
window.handleCaptcha = handleCaptcha;
|
||||
|
||||
function reAuth() {
|
||||
//First, save form state so their message can be recovered after
|
||||
//binding accounts.
|
||||
var data = {
|
||||
"link": sendData.link,
|
||||
"domain": sendData.domain,
|
||||
"formData": actions[sendData.domain].getFormData()
|
||||
};
|
||||
store.sessionRestore = JSON.stringify(data);
|
||||
showStatus('statusAuth');
|
||||
}
|
||||
|
||||
function sendMessage() {
|
||||
showStatus('statusSharing');
|
||||
|
||||
|
@ -324,7 +336,7 @@ function (require, $, fn, rdapi, oauth, jig, url,
|
|||
// XXX need to find out what error codes everyone uses
|
||||
// oauth+smtp will return a 535 on authentication failure
|
||||
if (code === 401 || code === 535) {
|
||||
showStatus('statusAuth');
|
||||
reAuth();
|
||||
} else if (json.error.code === 'Client.HumanVerificationRequired') {
|
||||
handleCaptcha(json.error.detail);
|
||||
} else if (json.error.code === 'Client.WrongInput') {
|
||||
|
@ -351,16 +363,7 @@ function (require, $, fn, rdapi, oauth, jig, url,
|
|||
//it is hard to see how that might happen -- either all the cookies
|
||||
//are gone or they are all there.
|
||||
//var headerError = xhr.getResponseHeader('X-Error');
|
||||
|
||||
//First, save form state so their message can be recovered after
|
||||
//binding accounts.
|
||||
var data = {
|
||||
"link": sendData.link,
|
||||
"domain": sendData.domain,
|
||||
"formData": actions[sendData.domain].getFormData()
|
||||
};
|
||||
store.sessionRestore = JSON.stringify(data);
|
||||
showStatus('statusCookiePukeError');
|
||||
reAuth();
|
||||
} else if (xhr.status === 503) {
|
||||
showStatus('statusServerBusy');
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче