aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-28 21:20:47 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-28 21:20:47 +0000
commit50a787d97dd18be567652a09daa6998368158764 (patch)
tree9ecfd21801f23c826c996fac3462db4494c95056 /js
parent4c4fa09266340488dac8ec1624aa233c89aadf68 (diff)
downloadelgg-50a787d97dd18be567652a09daa6998368158764.tar.gz
elgg-50a787d97dd18be567652a09daa6998368158764.tar.bz2
Fixes #3408. During token refresh, only touching hrefs that contain __elgg_ts and __elgg_token to avoid changing selector-only hrefs since fragment-only hrefs are normalized by the browser. Not sure how this didn't show up until now.
git-svn-id: http://code.elgg.org/elgg/trunk@9049 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js')
-rw-r--r--js/lib/security.js4
-rw-r--r--js/lib/ui.js1
2 files changed, 3 insertions, 2 deletions
diff --git a/js/lib/security.js b/js/lib/security.js
index fa0a6f7ef..486347b88 100644
--- a/js/lib/security.js
+++ b/js/lib/security.js
@@ -21,8 +21,8 @@ elgg.security.setToken = function(json) {
$('[name=__elgg_ts]').val(json.__elgg_ts);
$('[name=__elgg_token]').val(json.__elgg_token);
- //also update all links
- $('[href]').each(function() {
+ // also update all links that contain tokens and time stamps
+ $('[href*="__elgg_ts"][href*="__elgg_token"]').each(function() {
this.href = this.href
.replace(/__elgg_ts=\d*/, '__elgg_ts=' + json.__elgg_ts)
.replace(/__elgg_token=[0-9a-f]*/, '__elgg_token=' + json.__elgg_token);
diff --git a/js/lib/ui.js b/js/lib/ui.js
index 16f1f969c..85ca8caf1 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -36,6 +36,7 @@ elgg.ui.init = function () {
elgg.ui.toggles = function(event) {
event.preventDefault();
+ // @todo might want to switch this to elgg.getSelectorFromUrlFragment().
var target = $(this).toggleClass('elgg-state-active').attr('href');
$(target).slideToggle('medium');