From e4834027b09b0af94f52a1c33d59cddace9fdd1d Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 23 Jan 2018 11:03:53 -0700 Subject: [PATCH 1/2] Auth Callback Regression --- client/coral-auth-callback/src/index.js | 14 ++++++++++ public/javascripts/admin.js | 8 ------ public/javascripts/auth-callback.js | 4 --- views/admin/confirm-email.ejs | 10 +++++++- views/admin/password-reset.ejs | 9 +++++++ views/auth-callback.ejs | 2 +- webpack.config.js | 34 +++++++++++++++++++------ 7 files changed, 59 insertions(+), 22 deletions(-) create mode 100644 client/coral-auth-callback/src/index.js delete mode 100644 public/javascripts/admin.js delete mode 100644 public/javascripts/auth-callback.js diff --git a/client/coral-auth-callback/src/index.js b/client/coral-auth-callback/src/index.js new file mode 100644 index 000000000..b7f3ed226 --- /dev/null +++ b/client/coral-auth-callback/src/index.js @@ -0,0 +1,14 @@ +document.addEventListener('DOMContentLoaded', () => { + // Get the auth element and parse it as JSON by decoding it. + const auth = document.getElementById('auth'); + const doc = document.implementation.createHTMLDocument(''); + doc.body.innerHTML = auth.innerText; + + // Set the item in localStorage. + localStorage.setItem('auth', doc.body.textContent); + + // Close the window. + setTimeout(() => { + window.close(); + }, 50); +}); diff --git a/public/javascripts/admin.js b/public/javascripts/admin.js deleted file mode 100644 index 2c8b7c42a..000000000 --- a/public/javascripts/admin.js +++ /dev/null @@ -1,8 +0,0 @@ -function showError(error) { - try { - let err = JSON.parse(error); - $('.error-console').text(err.message).addClass('active'); - } catch (err) { - $('.error-console').text(error).addClass('active'); - } -} diff --git a/public/javascripts/auth-callback.js b/public/javascripts/auth-callback.js deleted file mode 100644 index f91f4d743..000000000 --- a/public/javascripts/auth-callback.js +++ /dev/null @@ -1,4 +0,0 @@ -document.addEventListener('DOMContentLoaded', function(event) { - localStorage.setItem('auth', document.getElementById('auth').innerText); - setTimeout(function() { window.close(); }, 50); -}); \ No newline at end of file diff --git a/views/admin/confirm-email.ejs b/views/admin/confirm-email.ejs index 0bc54990b..f8f6c62f2 100644 --- a/views/admin/confirm-email.ejs +++ b/views/admin/confirm-email.ejs @@ -20,9 +20,17 @@ - - + diff --git a/webpack.config.js b/webpack.config.js index d46c2cb7d..3367727f5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -19,7 +19,11 @@ const targetPlugins = manager.section('targets').plugins; debug(`Using ${pluginsPath} as the plugin configuration path`); -const buildTargets = ['coral-admin', 'coral-docs']; +const buildTargets = [ + 'coral-admin', + 'coral-docs', + { name: 'coral-auth-callback', disablePolyfill: true }, +]; const buildEmbeds = ['stream']; @@ -156,9 +160,14 @@ const config = { modules: [ path.resolve(__dirname, 'plugins'), path.resolve(__dirname, 'client'), - ...buildTargets.map(target => - path.join(__dirname, 'client', target, 'src') - ), + ...buildTargets.map(target => { + if (typeof target !== 'string') { + target = target.name; + } + + return path.join(__dirname, 'client', target, 'src'); + }), + ...buildEmbeds.map(embed => path.join(__dirname, 'client', `coral-embed-${embed}`, 'src') ), @@ -276,10 +285,19 @@ module.exports = [ // All framework targets/embeds/plugins. applyConfig([ // Load in all the targets. - ...buildTargets.map(target => ({ - name: `${target}/bundle`, - path: path.join(__dirname, 'client/', target, '/src/index'), - })), + ...buildTargets.map(target => { + let disablePolyfill = false; + if (typeof target !== 'string') { + disablePolyfill = target.disablePolyfill; + target = target.name; + } + + return { + name: `${target}/bundle`, + path: path.join(__dirname, 'client/', target, '/src/index'), + disablePolyfill, + }; + }), // Load in all the embeds. ...buildEmbeds.map(embed => ({ From 366f40a6e4df2adc9f7ecac50c0246265841a181 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 24 Jan 2018 10:09:33 -0700 Subject: [PATCH 2/2] applied fix to template --- views/admin/password-reset.ejs | 1 - 1 file changed, 1 deletion(-) diff --git a/views/admin/password-reset.ejs b/views/admin/password-reset.ejs index b8edb18af..c5bb4ef90 100644 --- a/views/admin/password-reset.ejs +++ b/views/admin/password-reset.ejs @@ -30,7 +30,6 @@ -