From 9584677574b7690469d84db6cb3dfc1cc825724d Mon Sep 17 00:00:00 2001 From: Paul Rodwell Date: Sun, 9 Apr 2017 10:18:51 +0100 Subject: [PATCH 1/2] update isAuthenticated on state change --- client/security.coffee | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/security.coffee b/client/security.coffee index d0b5768..f2204d5 100644 --- a/client/security.coffee +++ b/client/security.coffee @@ -63,8 +63,7 @@ update_footer = (ownerName, isAuthenticated) -> fetch '/logout', myInit .then (response) -> if response.ok - isAuthenticated = false - isOwner = false + window.isAuthenticated = false user = '' document.cookie = "state=loggedOut" + ";domain=." + settings.cookieDomain + "; path=/; max-age=60;" update_footer ownerName, isAuthenticated @@ -138,10 +137,12 @@ update_footer = (ownerName, isAuthenticated) -> }, (err, r) -> if err console.log err - else if !isClaimed - claim_wiki() else - update_footer ownerName, true) + window.isAuthenticated = true + if !isClaimed + claim_wiki() + else + update_footer ownerName, true) @@ -160,8 +161,8 @@ setup = (user) -> unless document.cookie.match('(?:^|;)\\s?state=(.*?)(?:;|$)') is null try switch document.cookie.match('(?:^|;)\\s?state=(.*?)(?:;|$)')[1] - when 'loggedIn' then isAuthenticated = true - when 'loggedOut' then isAuthenticated = false + when 'loggedIn' then window.isAuthenticated = true + when 'loggedOut' then window.isAuthenticated = false update_footer ownerName, isAuthenticated lastCookie = currentCookie , 100 From af2b4bb27b42668ed3f8e8334e5a2328e145ba40 Mon Sep 17 00:00:00 2001 From: Paul Rodwell Date: Sun, 9 Apr 2017 10:20:53 +0100 Subject: [PATCH 2/2] update dependencies --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 34f2549..2f5d1eb 100644 --- a/package.json +++ b/package.json @@ -5,24 +5,24 @@ "author": "Paul Rodwell (http://rodwell.me)", "license": "MIT", "dependencies": { - "coffee-script": "^1.11.1", - "es6-promise": "^4.0.5", - "lodash": "^4.17.2", + "coffee-script": "^1.12.4", + "es6-promise": "^4.1.0", + "lodash": "^4.17.4", "passport": "^0.3.2", "passport-github": "^1.1.0", "passport-google-oauth20": "^1.0.0", "passport-twitter": "^1.0.4", "persona-pass": "^0.2.1", - "qs": "^6.3.0", - "whatwg-fetch": "^2.0.1" + "qs": "^6.4.0", + "whatwg-fetch": "^2.0.3" }, "devDependencies": { - "coffeeify": "*", + "coffeeify": "^2.1.0", "grunt": "^1.0.1", "grunt-browserify": "~5", "grunt-contrib-watch": "~1", "grunt-git-authors": "^3.2.0", "grunt-nsp": "*", - "grunt-retire": "^1.0.3" + "grunt-retire": "^1.0.7" } }