bugfix non-admin errors

This commit is contained in:
iou1name 2020-11-20 21:13:35 -05:00
parent fc434f0d62
commit bdaf3730c4
2 changed files with 4 additions and 2 deletions

View File

@ -15,7 +15,9 @@ function load() {
}
});
});
document.querySelector('#user_perm_form').addEventListener('submit', submit_user_perms);
if (user_perms) {
document.querySelector('#user_perm_form').addEventListener('submit', submit_user_perms);
}
}
function submit_user_perms(event) {

View File

@ -4,7 +4,7 @@
<title>Buckler</title>
<link rel="stylesheet" type="text/css" href="/static/buckler.css">
<script>
var user_perms = {{ user_perms_json|safe }};
var user_perms = {% if request['session']['admin'] %}{{ user_perms_json|safe }}{% else %}null{% endif %};
</script>
<script type="text/javascript" src="/static/buckler.js"></script>
<script>window.onload = load;</script>