From 22ec94889d5867c07babaf2c85197f39c0ae46f1 Mon Sep 17 00:00:00 2001 From: Patrick Arlt Date: Wed, 9 May 2018 09:22:16 -0700 Subject: [PATCH] fix(oauth-demo): remove ES2015 buts from oAuth Demo for IE 11 --- demos/oauth2-browser/authenticate.html | 2 +- demos/oauth2-browser/index.html | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/demos/oauth2-browser/authenticate.html b/demos/oauth2-browser/authenticate.html index 4b091587e6..738aefc4a3 100644 --- a/demos/oauth2-browser/authenticate.html +++ b/demos/oauth2-browser/authenticate.html @@ -22,7 +22,7 @@ function processAuthentication() { window.location.href = '/'; session = arcgisRest.UserSession.completeOAuth2({ - clientId, + clientId: clientId, }); localStorage.setItem('__ARCGIS_REST_USER_SESSION__', session.serialize()); } diff --git a/demos/oauth2-browser/index.html b/demos/oauth2-browser/index.html index 71fdd118ab..4e1696d78d 100644 --- a/demos/oauth2-browser/index.html +++ b/demos/oauth2-browser/index.html @@ -5,6 +5,7 @@ ArcGIS REST JS Browser OAuth2 +
@@ -108,7 +109,7 @@

} // Define the variable used for the redirect uri. - const redirect_uri = `${window.location.origin}${window.location.pathname}`; + const redirect_uri = window.location.origin + window.location.pathname; // Inject that value into the page text. document.getElementById('redirect_uri').innerHTML = redirect_uri; @@ -130,7 +131,7 @@

} // Attach a listener to validate the client id on change. - document.getElementById('clientId').addEventListener('input', (event) => { + document.getElementById('clientId').addEventListener('input', function (event) { requireClientId(); }); @@ -140,7 +141,7 @@

if (session) { sessionInfo.classList.remove('bg-info'); sessionInfo.classList.add('bg-success'); - sessionInfo.innerHTML = `Logged in as ${session.username}.`; + sessionInfo.innerHTML = 'Logged in as ' + session.username; localStorage.setItem('__ARCGIS_REST_USER_SESSION__', session.serialize()); } else { sessionInfo.classList.remove('bg-success'); @@ -153,42 +154,42 @@

updateSessionInfo(session); // Attach a listener to the sign in buttons. - document.getElementById('withPopupButton').addEventListener('click', (event) => { + document.getElementById('withPopupButton').addEventListener('click', function (event) { event.preventDefault(); if (requireClientId()) { // Begin an OAuth2 login using a popup. arcgisRest.UserSession.beginOAuth2({ - clientId, - redirectUri: `${redirect_uri}authenticate.html`, + clientId: clientId, + redirectUri: redirect_uri + 'authenticate.html', popup: true - }).then((newSession) => { + }).then(function (newSession) { // Upon a successful login, update the session with the new session. session = newSession; console.log(session); updateSessionInfo(session); - }).catch(error => { + }).catch(function (error) { console.log(error); }); } }); // Attach a listener to the sign in buttons. - document.getElementById('inlineRedirectButton').addEventListener('click', (event) => { + document.getElementById('inlineRedirectButton').addEventListener('click', function (event) { event.preventDefault(); if (requireClientId()) { // let clientId = document.getElementById('clientId').value || configClientId; // Begin an OAuth2 login without a popup. arcgisRest.UserSession.beginOAuth2({ - clientId, - redirectUri: `${redirect_uri}authenticate.html?clientID=${clientId}`, + clientId: clientId, + redirectUri: redirect_uri + 'authenticate.html?clientID=' + clientId, popup: false, }); } }); // Attach a listener to the sign in buttons. - document.getElementById('signOutButton').addEventListener('click', (event) => { + document.getElementById('signOutButton').addEventListener('click', function (event) { event.preventDefault(); // Clear the previous session.