crafty-4/app/frontend/templates/panel/panel_edit_user.html

600 lines
26 KiB
HTML
Raw Normal View History

2020-12-24 22:55:15 +00:00
{% extends ../base.html %}
{% block meta %}
{% end %}
2022-08-07 18:45:13 +00:00
{% block title %}Crafty Controller - {{ translate('userConfig', 'userSettings',
data['lang']) }}{% end %}
2020-12-24 22:55:15 +00:00
{% block content %}
<div class="content-wrapper">
2022-04-03 00:37:22 +00:00
<!-- Page Title Header Starts-->
2020-12-24 22:55:15 +00:00
<div class="row page-title-header">
<div class="col-12">
<div class="page-header">
{% if data['new_user'] %}
2022-04-03 00:37:22 +00:00
<h4 class="page-title">
{{ translate('userConfig', 'pageTitleNew', data['lang']) }}
<br />
<small>UID: N/A</small>
</h4>
2020-12-24 22:55:15 +00:00
{% else %}
2022-04-03 00:37:22 +00:00
<h4 class="page-title">
{{ translate('userConfig', 'pageTitle', data['lang']) }}
<br />
<small>UID: {{ data['user']['user_id'] }}</small>
</h4>
2020-12-24 22:55:15 +00:00
{% end %}
</div>
</div>
</div>
<!-- Page Title Header Ends-->
<div class="row">
<div class="col-sm-12 grid-margin">
<div class="card">
<div class="card-body pt-0">
2022-04-03 00:37:22 +00:00
<ul class="nav nav-tabs col-md-12 tab-simple-styled " role="tablist">
<li class="nav-item">
<a class="nav-link active"
href="/panel/{{ 'add_user' if data['new_user'] else 'edit_user' }}?id={{ data['user']['user_id'] }}&subpage=config"
role="tab" aria-selected="true">
<i class="fas fa-cogs"></i> {{ translate('userConfig', 'config', data['lang']) }}</a>
</li>
{% if not data['new_user'] %}
<li class="nav-item">
<a class="nav-link" href="/panel/edit_user_apikeys?id={{ data['user']['user_id'] }}" role="tab"
aria-selected="false">
<i class="fas fa-key"></i>{{ translate('userConfig', 'apiKey', data['lang']) }}</a>
</li>
{% end %}
</ul>
<div class="row">
<div class="col-md-6 col-sm-12">
{% if data['new_user'] %}
2023-08-16 22:00:00 +00:00
<form id="user_form" class="forms-sample">
2022-04-03 00:37:22 +00:00
{% else %}
2023-08-16 22:00:00 +00:00
<form id="user_form" class="forms-sample">
2020-12-24 22:55:15 +00:00
{% end %}
2023-08-16 22:00:00 +00:00
2020-12-24 22:55:15 +00:00
2021-10-04 15:06:57 +00:00
2022-04-03 00:37:22 +00:00
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-user"></i> {{ translate('userConfig', 'userSettings',
data['lang']) }}</h4>
</div>
<div class="card-body">
2023-10-08 02:10:15 +00:00
{% if data['new_user'] %}
2022-04-03 00:37:22 +00:00
<div class="form-group">
<label class="form-label" for="username">{{ translate('userConfig', 'userName', data['lang'])
}}<small class="text-muted ml-1"> - {{ translate('userConfig', 'userNameDesc', data['lang'])
}}</small> </label>
2022-07-05 23:21:06 +00:00
<input type="text" class="form-control" name="username" id="username" autocomplete="off"
2022-07-05 23:49:51 +00:00
data-lpignore="true" value="{{ data['user']['username'] }}" placeholder="User Name">
2020-12-24 22:55:15 +00:00
</div>
2022-04-03 00:37:22 +00:00
<div class="form-group">
<label class="form-label" for="password0">{{ translate('userConfig', 'password', data['lang'])
}}<small class="text-muted ml-1"> - {{ translate('userConfig', 'leaveBlank', data['lang']) }}
</small> </label>
<input type="password" class="form-control" name="password0" id="password0" value=""
2023-08-16 22:00:00 +00:00
autocomplete="new-password" data-lpignore="true" placeholder="Password" form="dummy">
2022-07-06 00:27:10 +00:00
<span class="passwords-match" ,
data-content="{{ translate('panelConfig', 'match', data['lang']) }}" ,
data-placement="right"></span>
</div>
2022-04-03 00:37:22 +00:00
<div class="form-group">
<label class="form-label" for="password1">{{ translate('userConfig', 'repeat', data['lang']) }}
<small class="text-muted ml-1"> - {{ translate('userConfig', 'leaveBlank', data['lang'])
}}</small> </label>
<input type="password" class="form-control" name="password1" id="password1" value=""
2023-08-16 22:00:00 +00:00
autocomplete="new-password" data-lpignore="true" placeholder="Repeat Password" form="dummy">
2022-07-06 00:27:10 +00:00
<span class="passwords-match" ,
data-content="{{ translate('panelConfig', 'match', data['lang']) }}" ,
data-placement="right"></span>
</div>
2023-10-08 02:10:15 +00:00
{% else %}
<div class="form-group">
<label class="form-label" for="username">{{ translate('userConfig', 'userName', data['lang'])
}}<small class="text-muted ml-1"> - {{ translate('userConfig', 'userNameDesc', data['lang'])
}}</small> </label>
<input type="text" class="form-control" name="username" id="username" autocomplete="off"
data-lpignore="true" value="{{ data['user']['username'] }}" placeholder="User Name" disabled>
</div>
{% end %}
2022-04-03 00:37:22 +00:00
<div class="form-group">
<label class="form-label" for="email">{{ translate('userConfig', 'gravEmail', data['lang'])
}}<small class="text-muted ml-1"> - {{ translate('userConfig', 'gravDesc', data['lang'])
}}</small> </label>
2022-07-05 23:21:06 +00:00
<input type="email" class="form-control" name="email" id="email" autocomplete="off"
2022-07-05 23:49:51 +00:00
data-lpignore="true" value="{{ data['user']['email'] }}" placeholder="Gravatar Email">
2022-04-03 00:37:22 +00:00
</div>
<div class="form-group">
<label class="form-label" for="language">{{ translate('userConfig', 'userLang', data['lang'])
}}</label>
<select class="form-select form-control form-control-lg select-css" id="language"
2023-08-16 22:00:00 +00:00
name="lang" form="user_form">
2022-04-03 00:37:22 +00:00
{% for lang in data['languages'] %}
{% if not 'incomplete' in lang %}
<option value="{{lang}}">{{lang}}</option>
2020-12-24 22:55:15 +00:00
{% else %}
2022-04-03 00:37:22 +00:00
<option value="{{lang}}" disabled>{{lang}}</option>
2020-12-24 22:55:15 +00:00
{% end %}
{% end %}
2022-04-03 00:37:22 +00:00
</select>
</div>
2022-09-27 01:23:47 +00:00
<div class="form-group">
<label class="form-label" for="theme">{{ translate('userConfig', 'userTheme', data['lang'])
}}</label>
2022-11-09 19:13:35 +00:00
<select class="form-select form-control form-control-lg select-css" id="theme"
2022-09-27 01:23:47 +00:00
name="theme" form="user_form">
<option value="{{data['user'].get('theme', 'default')}}">{{data['user'].get('theme', 'default')}}</option>
{% for theme in data['themes'] %}
{% if theme != data['user'].get('theme', 'default') %}
<option value="{{theme}}">{{theme}}</option>
{% end %}
{% end %}
</select>
</div>
2022-08-19 17:09:59 +00:00
{% if data['superuser'] %}
<div class="form-group">
2022-08-19 19:08:35 +00:00
<label class="form-label" for="manager">{{ translate('userConfig', 'selectManager',
data['lang']) }}
2022-08-19 17:09:59 +00:00
</label>
<select class="form-select form-control form-control-lg select-css" id="manager" name="manager"
form="user_form">
{% if data["manager"]["username"] != "None" %}
<option value='{{data["manager"]["user_id"]}}'>{{ data["manager"]["username"]
}}</option>
{% end %}
<option value="">None</option>
{% for user in data['users'] %}
{% if user.username != data['user']['username'] and user.user_id != data['manager']['user_id']
%}
<option value="{{user.user_id}}">{{user.username}}</option>
{% end %}
{% end %}
</select>
</div>
{% end %}
2022-04-03 00:37:22 +00:00
</div>
</div>
2020-12-24 22:55:15 +00:00
2022-04-03 00:37:22 +00:00
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('userConfig', 'userRoles',
data['lang']) }} <small class="text-muted ml-1"> - {{ translate('userConfig', 'userRolesDesc',
data['lang']) }}</small></h4>
</div>
<div class="card-body">
<div class="form-group">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr class="rounded">
<th>{{ translate('userConfig', 'roleName', data['lang']) }}</th>
<th>{{ translate('userConfig', 'member', data['lang']) }}</th>
</tr>
</thead>
<tbody>
{% for role in data['roles'] %}
2022-04-03 00:37:22 +00:00
<tr>
{% if data['superuser'] or role.role_id in data['user']['roles'] or role.manager == data['exec_user'] %}
2022-04-03 00:37:22 +00:00
<td>{{ role.role_name }}</td>
<td>
{% if role.role_id in data['user']['roles'] %}
{% if role.manager == data['exec_user'] or data['superuser'] %}
2023-08-16 22:00:00 +00:00
<input type="checkbox" class="form-check-input role_check"
2022-04-03 00:37:22 +00:00
id="role_{{ role.role_id }}_membership" name="role_{{ role.role_id }}_membership"
2023-08-16 22:00:00 +00:00
checked="" value="{{role.role_id}}" form="dummy">
2022-04-03 00:37:22 +00:00
{% else %}
2023-08-16 22:00:00 +00:00
<input type="checkbox" class="form-check-input role_check"
id="role_{{ role.role_id }}_membership" name="role_{{ role.role_id }}_membership"
2023-08-16 22:00:00 +00:00
checked="" value="{{role.role_id}}" disabled form="dummy">
{% end %}
{% elif data['superuser'] or role.manager == data['exec_user'] %}
2023-08-16 22:00:00 +00:00
<input type="checkbox" class="form-check-input role_check"
2022-04-03 00:37:22 +00:00
id="role_{{ role.role_id }}_membership" name="role_{{ role.role_id }}_membership"
2023-08-16 22:00:00 +00:00
value="{{role.role_id}}" form="dummy">
2022-04-03 00:37:22 +00:00
{% end %}
</td>
{% end %}
2022-04-03 00:37:22 +00:00
</tr>
{% end %}
</tbody>
</table>
</div>
2020-12-24 22:55:15 +00:00
</div>
2022-04-03 00:37:22 +00:00
</div>
</div>
2021-10-04 15:06:57 +00:00
2022-04-03 00:37:22 +00:00
<!-- Put Permissions Crafty part here -->
{% if data['superuser'] %}
2022-04-03 00:37:22 +00:00
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-user-lock"></i> {{ translate('userConfig', 'craftyPerms',
data['lang']) }} <small class="text-muted ml-1"> - {{ translate('userConfig', 'craftyPermDesc',
data['lang']) }}</small></h4>
</div>
2022-04-03 00:37:22 +00:00
<div class="card-body">
<div class="form-group">
<div class="table-responsive">
2023-09-04 22:26:04 +00:00
<table id="permissions" aria-describedby="User Crafty Permissions" class="table table-hover">
2022-04-03 00:37:22 +00:00
<thead>
<tr class="rounded">
<th>{{ translate('userConfig', 'permName', data['lang']) }}</th>
<th>{{ translate('userConfig', 'auth', data['lang']) }}</th>
<th>{{ translate('userConfig', 'uses', data['lang']) }}</th>
</tr>
</thead>
<tbody>
{% for permission in data['permissions_all'] %}
<tr>
<td>{{ permission.name }}</td>
<td>
{% if permission in data['permissions_list'] %}
2023-08-16 22:00:00 +00:00
<input type="checkbox" class="form-check-input perm-name" id="permission_{{ permission.name }}"
name="permission_{{ permission.name }}" checked="" value="1" data-perm="{{permission.name}}" form="dummy">
2022-04-03 00:37:22 +00:00
{% else %}
2023-08-16 22:00:00 +00:00
<input type="checkbox" class="form-check-input perm-name" id="permission_{{ permission.name }}"
name="permission_{{ permission.name }}" value="1" data-perm="{{permission.name}}" form="dummy">
2022-04-03 00:37:22 +00:00
{% end %}
</td>
<td><input type="text" class="form-control" name="quantity_{{ permission.name }}"
id="quantity_{{ permission.name }}"
2023-08-16 22:00:00 +00:00
value="{{ data['quantity_server'][permission.name] }}" data-perm="{{permission.name}}" form="dummy"></td>
2022-04-03 00:37:22 +00:00
</tr>
{% end %}
</tbody>
</table>
</div>
2020-12-24 22:55:15 +00:00
</div>
</div>
2022-04-03 00:37:22 +00:00
</div>
{% end %}
2022-04-03 00:37:22 +00:00
<div class="form-check-flat">
<label for="enabled" class="form-check-label ml-4 mb-4">
{% if data['user']['enabled'] %}
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" checked=""
value="1">{{ translate('userConfig', 'enabled', data['lang']) }}
{% else %}
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" value="1">{{
translate('userConfig', 'enabled', data['lang']) }}
{% end %}
</label>
<label for="superuser" class="form-check-label ml-4 mb-4">
{% if data['user']['superuser'] %}
<input type="checkbox" onclick="superConfirm()" class="form-check-input" id="superuser"
name="superuser" checked="" value="1" {{ data['super-disabled'] }}>{{ translate('userConfig',
'super', data['lang']) }}
{% else %}
<input type="checkbox" onclick="superConfirm()" class="form-check-input" id="superuser"
name="superuser" {{ data['super-disabled'] }} value="1">{{ translate('userConfig', 'super',
data['lang']) }}
{% end %}
</label>
2022-04-03 01:25:26 +00:00
<label for="hints" class="form-check-label ml-4 mb-4">
{% if data['user']['hints'] %}
<input type="checkbox" class="form-check-input" id="hints" name="hints" checked=""
value="1">Enable Hints?
{% else %}
<input type="checkbox" class="form-check-input" id="hints" name="hints" value="1"> Enable
Hints?
{% end %}
</label>
2022-04-03 00:37:22 +00:00
</div>
2023-08-16 22:00:00 +00:00
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{
2022-04-03 00:37:22 +00:00
translate('panelConfig', 'save', data['lang']) }}</button>
<button type="reset" onclick="location.href='/panel/panel_config'" class="btn btn-light"><i
class="fas fa-undo-alt"></i> {{ translate('panelConfig', 'cancel', data['lang']) }}</button>
</form>
</div>
2020-12-24 22:55:15 +00:00
2022-04-03 00:37:22 +00:00
<div class="col-md-6 col-sm-12">
<div class="card">
<div class="card-body">
<h4 class="card-title"><i class="fas fa-user-cog"></i> {{ translate('userConfig', 'configArea',
data['lang']) }}</h4>
<p class="card-description"> {{ translate('userConfig', 'configAreaDesc', data['lang']) }}</p>
<blockquote class="blockquote">
<p class="mb-0">
{{ translate('userConfig', 'created', data['lang']) }} {{ str(data['user']['created']) }}
<br />
{{ translate('userConfig', 'lastLogin', data['lang']) }} {{ str(data['user']['last_login']) }}
<br />
{{ translate('userConfig', 'lastUpdate', data['lang']) }} {{ str(data['user']['last_update']) }}
<br />
{{ translate('userConfig', 'lastIP', data['lang']) }} {{ data['user']['last_ip'] }}
<br />
2022-08-19 19:08:35 +00:00
{{ translate('userConfig', 'manager', data['lang'])}}: {{data['manager']['username'] }}
<br />
2022-04-03 00:37:22 +00:00
</p>
</blockquote>
2020-12-24 22:55:15 +00:00
</div>
2022-04-03 00:37:22 +00:00
</div>
<div class="text-center">
{% if data['new_user'] %}
<a class="btn btn-sm btn-danger disabled"><i class="fas fa-trash"></i>{{ translate('userConfig',
'deleteUserB', data['lang']) }}</a><br />
<small>{{ translate('userConfig', 'notExist', data['lang']) }}</small>
{% elif data['user']['superuser'] %}
<a class="btn btn-sm btn-danger disabled"><i class="fas fa-trash"></i> {{ translate('userConfig',
'deleteUserB', data['lang']) }}</a><br />
<small>{{ translate('userConfig', 'delSuper', data['lang']) }}</small>
{% else %}
<button class="btn btn-sm btn-danger delete-user"><i class="fas fa-trash"></i> {{
translate('userConfig', 'deleteUserB', data['lang']) }}</a>
2022-08-19 17:09:59 +00:00
{% end %}</button>
2022-04-03 00:37:22 +00:00
</div>
2020-12-24 22:55:15 +00:00
</div>
2022-04-03 00:37:22 +00:00
</div>
2020-12-24 22:55:15 +00:00
</div>
</div>
</div>
</div>
</div>
2022-07-06 00:27:10 +00:00
<style>
.popover-body {
color: white !important;
outline: 1px solid red !important;
;
}
</style>
2020-12-24 22:55:15 +00:00
<!-- content-wrapper ends -->
{% end %}
{% block js %}
<script>
2023-10-30 16:13:14 +00:00
const userId = new URLSearchParams(document.location.search).get('id');
2022-07-06 00:27:10 +00:00
function submit_user(event) {
if (!validateForm()) {
event.preventDefault();
} else {
$('#userForm').submit();
}
}
function validateForm() {
2023-08-16 22:00:00 +00:00
let password0 = document.getElementById("password0").value;
let password1 = document.getElementById("password1").value;
if (password0 === "" && password1 === "" && userId){
return true
}
else if (password0 != password1) {
2022-07-06 00:27:10 +00:00
$('.passwords-match').popover('show');
$('.popover-body').click(function () {
$('.passwords-match').popover("hide");
});
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
$("#password0").css("outline", "1px solid red");
$("#password1").css("outline", "1px solid red");
return false;
} else {
2023-08-16 22:00:00 +00:00
return password1;
2022-07-06 00:27:10 +00:00
}
}
2023-08-16 22:00:00 +00:00
function replacer(key, value) {
if (typeof value == "boolean" || key === "email" || key === "permissions" || key === "roles") {
return value
} else {
console.log(key, value)
return (isNaN(value) ? value : +value);
}
}
$("#user_form").on("submit", async function (e) {
e.preventDefault();
2023-10-08 02:10:15 +00:00
let password = null;
if(!userId){
password = validateForm();
2023-10-08 21:02:27 +00:00
if (!password){
2023-10-08 02:10:15 +00:00
return;
}
2023-10-08 21:02:27 +00:00
}
2023-09-04 23:22:11 +00:00
const token = getCookie("_xsrf")
2023-10-08 20:39:04 +00:00
let userRes = await fetch(`/api/v2/users/@me`, {
method: "GET",
headers: {
'X-XSRFToken': token
},
});
let userData = await userRes.json();
let superuser = null;
if (userData.status === "ok") {
superuser = userData.data["superuser"];
edit_id = userData.data["user_id"];
} else {
bootbox.alert({
title: userData.error,
message: userData.error
});
}
2023-08-16 22:00:00 +00:00
let userForm = document.getElementById("user_form");
let disabled_flag = false;
2023-10-08 20:39:04 +00:00
let roles = null;
if (superuser || userId != edit_id){
roles = $('.role_check').map(function() {
2023-08-16 22:00:00 +00:00
if ($(this).attr("disabled")){
disabled_flag = true;
}
if ($(this).is(':checked')){
return $(this).val();
}
}).get();
let avail_permissions = $('.perm-name').map(function() {
return $(this).data("perm");
}).get();
permissions = []
for(i=0; i < avail_permissions.length; i++){
permissions.push({"name": avail_permissions[i], "quantity": $(`#quantity_${avail_permissions[i]}`).val(), "enabled": $(`#permission_${avail_permissions[i]}`).is(':checked')})
}
2023-10-08 20:39:04 +00:00
}
2023-08-16 22:00:00 +00:00
let formData = new FormData(userForm);
//Create an object from the form data entries
let formDataObject = Object.fromEntries(formData.entries());
if(userId){
delete formDataObject.username
}
2023-10-08 20:39:04 +00:00
if (superuser || userId != edit_id){
2023-08-16 22:00:00 +00:00
if (!disabled_flag){
formDataObject.roles = roles;
}
if ($("#permissions").length){
formDataObject.permissions = permissions;
}
if(!userId){
2023-10-08 02:10:15 +00:00
if(typeof password === "string"){
2023-08-16 22:00:00 +00:00
formDataObject.password = password;
}
2023-10-08 02:10:15 +00:00
}
2023-10-08 20:39:04 +00:00
}
2023-08-16 22:00:00 +00:00
formDataObject.enabled = $("#enabled").is(":checked");
if ($("#superuser").is(":enabled")){
formDataObject.superuser = $("#superuser").is(":checked");
}
formDataObject.hints = $("#hints").is(":checked");
console.log(formDataObject);
2023-08-16 22:00:00 +00:00
//We need to make sure these are sent regardless of whether or not they're checked
// Format the plain form data as JSON
let formDataJsonString = JSON.stringify(formDataObject, replacer);
console.log(formDataJsonString);
if (userId){
url = `/api/v2/users/${userId}`
method = 'PATCH'
}else{
url = `/api/v2/users/`
method = 'POST'
}
let res = await fetch(url, {
method: method,
headers: {
'X-XSRFToken': token
},
body: formDataJsonString,
});
let responseData = await res.json();
if (responseData.status === "ok") {
window.location.href = "/panel/panel_config";
} else {
if (responseData.hasOwnProperty("error_data")){
bootbox.alert({
title: responseData.error,
message: responseData.error_data
});
}else{
bootbox.alert(responseData.error
);
}
}
});
2022-04-03 00:37:22 +00:00
$(".delete-user").click(function () {
var file_to_del = $(this).data("file");
2022-04-03 00:37:22 +00:00
console.log("User to delete is " + userId);
bootbox.confirm({
2022-04-03 00:37:22 +00:00
title: "{% raw translate('userConfig', 'deleteUser', data['lang']) %} " + userId,
message: "{{ translate('userConfig', 'confirmDelete', data['lang']) }}",
buttons: {
cancel: {
label: '<i class="fas fa-times"></i> {{ translate("serverBackups", "cancel", data['lang']) }}'
},
2022-04-03 00:37:22 +00:00
confirm: {
className: 'btn-outline-danger',
label: '<i class="fas fa-check"></i> {{ translate("serverBackups", "confirm", data['lang']) }}'
}
2022-04-03 00:37:22 +00:00
},
2023-08-16 22:00:00 +00:00
callback: async function (result) {
2022-04-03 00:37:22 +00:00
console.log(result);
2022-04-03 01:47:32 +00:00
if (result === true) {
2023-09-04 23:22:11 +00:00
const token = getCookie("_xsrf")
2023-08-16 22:00:00 +00:00
let res = await fetch(`/api/v2/users/${userId}`, {
method: "DELETE",
headers: {
'X-XSRFToken': token
},
});
let responseData = await res.json();
if (responseData.status === "ok") {
window.location.href = "/panel/panel_config";
} else {
bootbox.alert({
title: responseData.error,
message: responseData.error
});
}
}
2022-04-03 00:37:22 +00:00
}
});
2022-04-03 00:37:22 +00:00
});
2020-12-24 22:55:15 +00:00
function superConfirm() {
2022-04-03 00:37:22 +00:00
if (document.getElementById('superuser').checked) {
bootbox.confirm({
title: "{{ translate('panelConfig', 'superConfirmTitle', data['lang']) }}",
message: "{{ translate('panelConfig', 'superConfirm', data['lang']) }}",
buttons: {
cancel: {
2022-04-03 00:37:22 +00:00
label: '<i class="fa fa-times"></i> {{ translate('panelConfig', 'cancel', data['lang']) }}'
},
confirm: {
className: 'btn-outline-warning',
2022-04-03 00:37:22 +00:00
label: '<i class="fa fa-check"></i> {{ translate('serverBackups', 'confirm', data['lang']) }}'
}
2022-04-03 00:37:22 +00:00
},
callback: function (result) {
2022-04-03 01:47:32 +00:00
if (result === true) {
return;
2022-04-03 00:37:22 +00:00
} else {
document.getElementById('superuser').checked = false;
}
2022-04-03 00:37:22 +00:00
}
});
} else {
return
}
}
2020-12-24 22:55:15 +00:00
2022-04-03 00:37:22 +00:00
//used to get cookies from browser - this is part of tornados xsrf protection - it's for extra security
function getCookie(name) {
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
return r ? r[1] : undefined;
}
2020-12-24 22:55:15 +00:00
2022-04-03 00:37:22 +00:00
$(document).ready(function () {
console.log("ready!");
2020-12-24 22:55:15 +00:00
2022-04-03 00:37:22 +00:00
});
2020-12-24 22:55:15 +00:00
</script>
{% end %}