Skip to content

Instantly share code, notes, and snippets.

@joshcanhelp
Last active March 17, 2021 17:47
Show Gist options
  • Save joshcanhelp/f3bd076aa6f7bb3da8388dc3f45c6f9d to your computer and use it in GitHub Desktop.
Save joshcanhelp/f3bd076aa6f7bb3da8388dc3f45c6f9d to your computer and use it in GitHub Desktop.
Easy ULP modification with Netlify
# ...
export AUTH0_API2_TOKEN="Your management API token goes here"
export AUTH0_API2_DOMAIN="Your tenant domain goes here"
# https://cli.netlify.com/
alias sync_ulp='netlify deploy --prod --dir . && curl --request PUT \
--data "@./index.html" \
--header "authorization: Bearer $AUTH0_API2_TOKEN" \
--url "https://$AUTH0_API2_DOMAIN/api/v2/branding/templates/universal-login" \
--header "content-type: text/html"'
# ...
<!DOCTYPE html>
<html>
<head>
{%- auth0:head -%}
<link href="//elated-hawking-b7264a.netlify.app/ulp.css" rel="stylesheet" />
<title>{{ prompt.screen.texts.pageTitle }}</title>
</head>
<body class="_widget-auto-layout">
{%- auth0:widget -%}
<script src="//elated-hawking-b7264a.netlify.app/ulp.js"></script>
</body>
</html>
body {
background: rgb(255,221,221);
background: linear-gradient(158deg, rgba(255,221,221,1) 0%, rgba(245,217,217,1) 36%, rgba(215,255,229,1) 67%, rgba(207,255,224,1) 100%);
}
console.log("JS loaded ✅");
// Note: this only catches DB logins
const form = document.getElementsByTagName('form')[0];
form.addEventListener('submit', pauseSubmit);
function pauseSubmit(event) {
event.preventDefault();
console.log("Form submitted 💥");
window.setTimeout(() => {
console.log("Onward ⏩");
form.submit();
}, 2000);
}
@joshcanhelp
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment