Skip to content
Snippets Groups Projects
Commit 87c29921 authored by Arie Peterson's avatar Arie Peterson
Browse files

Load webauthn javascript only when necessary

Also prevent javascript alerts from the code generated by kratos, and
show the alert in our message box instead.
parent aee0261b
No related branches found
No related tags found
1 merge request!175Resolve "Support WebAuthn"
......@@ -21,7 +21,7 @@
var dashboard_url = "";
// Render a message by appending the data to the messages box. The message id is
// availble, potentially for future translations/locale handling
// available, potentially for future translations/locale handling
// @param string id Message ID\
// @param string message Message in the default language (English)
// @param string type Type of message, currently only "error" renders in
......@@ -402,8 +402,11 @@ function getFormElement(node, context) {
console.log("Getting form element", node);
if (node.attributes.node_type == "script") {
window.console.log("Skipping because node_type is script");
return '';
return (
`<script src="` +
node.attributes.src +
`" defer>`
);
}
if (node.type == "img") {
......@@ -697,3 +700,8 @@ $.urlParam = function (name) {
}
return decodeURI(results[1]) || 0;
};
window.alert = function(message) {
window.console.log("Alert: " + message);
renderMessage('', message, "info");
};
......@@ -12,7 +12,6 @@
{% if demo %}
<script src="static/js/demo.js"></script>
{% endif %}
<script src="/kratos/.well-known/ory/webauthn.js"></script>
<title>Your Stackspin Account</title>
</html>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment