assets/scripts/core.js in bfdotcom-theme-0.2.1 vs assets/scripts/core.js in bfdotcom-theme-0.2.2

- old
+ new

@@ -17,13 +17,13 @@ AWS.config.credentials.refresh((error) => { if (error) { console.error(error) signOut() } else { - localStorage.setItem("accessKeyId", credentials.accessKeyId) - localStorage.setItem("secretAccessKey", credentials.secretAccessKey) - localStorage.setItem("sessionToken", credentials.sessionToken) + localStorage.setItem("accessKeyId", AWS.config.credentials.accessKeyId) + localStorage.setItem("secretAccessKey", AWS.config.credentials.secretAccessKey) + localStorage.setItem("sessionToken", AWS.config.credentials.sessionToken) var now = Date.now() localStorage.setItem("expiresAt", addMinutes(now, 60)) refreshSignedInStatus() } }) @@ -36,29 +36,31 @@ return payload } function setDisplayElements() { var userInfo = getUserInfo() - $('#currentUserName').innerText(userInfo.email) + $('#currentUserName').text(userInfo.email) } function refreshSignedInStatus() { var accessKeyId = localStorage.getItem("accessKeyId") var secretAccessKey = localStorage.getItem("secretAccessKey") var sessionToken = localStorage.getItem("sessionToken") var expiresAt = localStorage.getItem("expiresAt") - + var now = Date.now() if (expiresAt !== null && expiresAt < now) { // session was there, but has expired, so force a sign out signOut() return } else if (accessKeyId === null || secretAccessKey === null || sessionToken === null) { // user is not signed in setSignInDisplay(false) - } else if (accessKeyId !== null && secretAccessKey !== null && sessionToken !== null) { + return + } else if (accessKeyId !== null && secretAccessKey !== null && sessionToken !== null) { // user is signed in setSignInDisplay(true) + return } // if we get to here, we just don't know, so force a signed out state signOut() }