From bfbd1f2d1d3fc9554427fce433ca0a5e6c022f79 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 21 Apr 2015 23:11:14 -0400 Subject: [PATCH] Clear cached userDetails when auth events occur (fixes #2588) --- js/id/core/connection.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/id/core/connection.js b/js/id/core/connection.js index 3a16b19ff..652099806 100644 --- a/js/id/core/connection.js +++ b/js/id/core/connection.js @@ -18,8 +18,10 @@ iD.Connection = function() { nodeStr = 'node', wayStr = 'way', relationStr = 'relation', + userDetails, off; + connection.changesetURL = function(changesetId) { return url + '/changeset/' + changesetId; }; @@ -283,8 +285,6 @@ iD.Connection = function() { }); }; - var userDetails; - connection.userDetails = function(callback) { if (userDetails) { callback(undefined, userDetails); @@ -411,6 +411,7 @@ iD.Connection = function() { }; connection.flush = function() { + userDetails = undefined; _.forEach(inflight, abortRequest); loadedTiles = {}; inflight = {}; @@ -424,12 +425,14 @@ iD.Connection = function() { }; connection.logout = function() { + userDetails = undefined; oauth.logout(); event.auth(); return connection; }; connection.authenticate = function(callback) { + userDetails = undefined; function done(err, res) { event.auth(); if (callback) callback(err, res);