Skip to content

Instantly share code, notes, and snippets.

@aonamrata
Last active December 27, 2019 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aonamrata/36eb19345d64ebdc049c8274acefa08c to your computer and use it in GitHub Desktop.
Save aonamrata/36eb19345d64ebdc049c8274acefa08c to your computer and use it in GitHub Desktop.
guardian_multifactor.html
<!DOCTYPE html>
<html>
<head>
<title>2nd Factor Authentication</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
html, body { padding: 0; margin: 0; }
.table {
display: table;
position: absolute;
height: 100%;
width: 100%;
background-color: #2b2b33;
}
.cell {
display: table-cell;
vertical-align: middle;
}
.content {
padding: 25px 0px 25px 0px;
margin-left: auto;
margin-right: auto;
width: 280px; /* login widget width */
}
[data-screen="auth-congrats"] .auth0-mfa-confirmation:after {
display: inline-block;
position: relative;
left: 43%;
}
[data-screen="auth-congrats"] .auth0-mfa-confirmation:after {
content: " ";
display: block;
width: 30px;
height: 30px;
margin: 1px;
border-radius: 20px;
border: 2px solid black;
border-color: rgba(0,0,0,.4) rgba(0,0,0,.4) rgba(0,0,0,.2) rgba(0,0,0,.2);
opacity: .9;
animation: auth0-mfa-confirmation 1s linear infinite;
}
@keyframes auth0-mfa-confirmation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="table">
<div class="cell">
<div class="content">
<!-- WIDGET -->
<div class="js-mfa-container mfa-container" id="container"></div>
</div>
</div>
</div>
<script src="//cdn.auth0.com/js/mfa-widget/mfa-widget-1.6.3.min.js"></script>
<script src="https://browser.sentry-cdn.com/4.6.4/bundle.min.js" crossorigin="anonymous"></script>
<script>
Sentry.init({
dsn: '##SENTRY_DNS##'
});
</script>
<script>
(function() {
let url = "{{ postActionURL }}";
if (!url || url == '')
url = "https://mysite/login/auth0redirect?error=unauthorized&error_description=mfa-reset";
const widget = new Auth0MFAWidget({
container: "container",
theme: {
icon: '##CDN_URL##/images/OrchardLogo.png',
primaryColor: "#f48b41"
},
requesterErrors: [
{% for error in errors %}
{ message: "{{ error.message }}", errorCode: "{{ error.code }}" }
{% endfor %}
],
mfaServerUrl: "{{ mfaServerUrl }}",
{% if ticket %}
ticket: "{{ ticket }}",
{% else %}
requestToken: "{{ requestToken }}",
{% endif %}
postActionURL: url,
userData: {
userId: "{{ userData.userId }}",
email: "{{ userData.email }}",
friendlyUserId: "{{ userData.friendlyUserId }}",
tenant: "{{ userData.tenant }}",
{% if userData.tenantFriendlyName %}
tenantFriendlyName: "{{ userData.tenantFriendlyName }}"
{% endif %}
},
globalTrackingId: "{{ globalTrackingId }}",
{% if allowRememberBrowser %}allowRememberBrowser: {{ allowRememberBrowser }}, {% endif %}
{% if stateCheckingMechanism %}stateCheckingMechanism: "{{ stateCheckingMechanism }}", {% endif %}
});
function handle(name) {
const handler = function (data) {
let errorCode = '';
let sentry_msg = 'got event: ' + name;
if (data.errorCode !== undefined && data.errorCode !== '') {
errorCode = data.errorCode;
sentry_msg += ' with code ' + errorCode;
}
Sentry.addBreadcrumb({
event: name,
category: 'auth',
data: {
event: name,
event_data: data ,
raw: errorCode,
userid: "{{ userData.userId }}",
globalTrackingId: "{{ globalTrackingId }}",
systemTime: new Date().toUTCString(),
},
level: 'info'
});
Sentry.captureMessage(sentry_msg);
};
widget.events.on(name, handler);
}
handle('local-error')
handle('tx-expired')
return widget;
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment