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 => ({