Permalink
Browse files

fix(js): do not trigger generic ajax error message for token refresh

  • Loading branch information...
jdalsem committed Mar 23, 2016
1 parent 1b5a765 commit e052481fa31102e78c6a7be9fd5730d730579984
Showing with 10 additions and 7 deletions.
  1. +10 −7 js/lib/security.js
View
@@ -35,14 +35,17 @@ elgg.security.setToken = function(json) {
* @private
*/
elgg.security.refreshToken = function() {
elgg.getJSON('refresh_token', function(data) {
if (data && data.__elgg_ts && data.__elgg_token) {
elgg.security.setToken(data);
if (elgg.is_logged_in() && data.logged_in === false) {
elgg.session.user = null;
elgg.register_error(elgg.echo('session_expired'));
elgg.getJSON('refresh_token', {
success: function(data) {
if (data && data.__elgg_ts && data.__elgg_token) {
elgg.security.setToken(data);
if (elgg.is_logged_in() && data.logged_in === false) {
elgg.session.user = null;
elgg.register_error(elgg.echo('session_expired'));
}
}
}
},
error: function() {},
});
};

0 comments on commit e052481

Please sign in to comment.