mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Double-checking when cookie lost to ensure it is actually lost. Re-sending request.
This commit is contained in:
parent
bf0231a299
commit
9c17c74e8b
2 changed files with 19 additions and 7 deletions
|
@ -94,13 +94,25 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
|||
success: function(o) {
|
||||
// NEWSBLUR.log(['make_request 1', o]);
|
||||
|
||||
var lost_authentication = self.check_authentication_lost(o);
|
||||
if (lost_authentication) {
|
||||
if (options.retry) {
|
||||
console.log(['Retrying due to lost auth cookie', o]);
|
||||
options.retry = false;
|
||||
self.make_request(url, data, callback, error_callback, options);
|
||||
} else {
|
||||
console.log(['Woah! Lost auth cookie, letting user know...']);
|
||||
NEWSBLUR.reader.show_authentication_lost();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (o && o.code < 0 && error_callback) {
|
||||
error_callback(o);
|
||||
} else if ($.isFunction(callback)) {
|
||||
callback(o);
|
||||
}
|
||||
|
||||
self.ensure_authenticated(o);
|
||||
},
|
||||
error: function(e, textStatus, errorThrown) {
|
||||
if (errorThrown == 'abort') {
|
||||
|
@ -610,13 +622,13 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
|||
}
|
||||
},
|
||||
|
||||
ensure_authenticated: function(data) {
|
||||
if (!NEWSBLUR.Globals.is_authenticated) return;
|
||||
if (_.isUndefined(data.authenticated)) return;
|
||||
check_authentication_lost: function(data) {
|
||||
if (!NEWSBLUR.Globals.is_authenticated) return false;
|
||||
if (_.isUndefined(data.authenticated)) return false;
|
||||
if (NEWSBLUR.Globals.is_authenticated != data.authenticated) {
|
||||
console.log(['Woah! Lost auth cookie, letting user know...']);
|
||||
NEWSBLUR.reader.show_authentication_lost();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
load_canonical_feed: function(feed_id, callback) {
|
||||
|
|
|
@ -49,7 +49,7 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
|
|||
// ===========
|
||||
|
||||
setup_dashboard_refresh: function() {
|
||||
// if (NEWSBLUR.Globals.debug) return;
|
||||
if (NEWSBLUR.Globals.debug) return;
|
||||
|
||||
// Reload dashboard graphs every 10 minutes.
|
||||
var reload_interval = NEWSBLUR.Globals.is_staff ? 60*1000 : 10*60*1000;
|
||||
|
|
Loading…
Add table
Reference in a new issue