ail-framework/var/www/templates/settings/users_list.html

164 lines
7.4 KiB
HTML
Raw Permalink Normal View History

2024-05-08 12:09:53 +00:00
<!DOCTYPE html>
<html>
<head>
<title>Users Settings - AIL</title>
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
<!-- Core CSS -->
<link href="{{ url_for('static', filename='css/bootstrap4.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/dataTables.bootstrap.min.css') }}" rel="stylesheet">
<!-- JS -->
<script src="{{ url_for('static', filename='js/jquery.js')}}"></script>
<script src="{{ url_for('static', filename='js/popper.min.js')}}"></script>
<script src="{{ url_for('static', filename='js/bootstrap4.min.js')}}"></script>
<script src="{{ url_for('static', filename='js/jquery.dataTables.min.js')}}"></script>
<script src="{{ url_for('static', filename='js/dataTables.bootstrap.min.js')}}"></script>
</head>
<body>
{% include 'nav_bar.html' %}
<div class="container-fluid">
<div class="row">
{% include 'settings/menu_sidebar.html' %}
<div class="col-12 col-lg-10" id="core_content">
<h3>AIL Users:</h3>
<table id="tableusers" class="table table-hover table-striped">
<thead class="thead-dark">
<tr>
<th>User</th>
<th>Org</th>
<th>Last Edit</th>
<th>Last Login</th>
<th>Last Seen</th>
2024-05-08 12:09:53 +00:00
<th>Role</th>
<th>Api Key</th>
<th></th>
2024-06-27 15:06:05 +00:00
<th>2FA</th>
2024-05-08 12:09:53 +00:00
<th>Actions</th>
</tr>
</thead>
<tbody id="tbody_last_crawled">
{% for user in meta['users'] %}
<tr>
<td>{{user['id']}}</td>
<td>
{{ user['org_name'] }}<br>
{{user['org']}}
</td>
<td>{{user['last_edit']}}</td>
<td>
{% if user['last_login'] %}
{{user['last_login']}}
{% else %}-{% endif %}
{{ meta['is_logged'] }}
{% if user['is_logged'] %}
<i class="fas fa-plug text-success"></i>
<a class="btn btn-outline-danger px-1 py-0" href="{{ url_for('settings_b.user_logout', user_id=user['id']) }}">
<i class="fas fa-sign-out-alt"></i>
</a>
{% endif %}
</td>
<td>{% if user['last_seen'] %}{{user['last_seen']}}{% else %}-{% endif %}</td>
2024-05-08 12:09:53 +00:00
<td>{{user['role']}}</td>
<td>
<span id="censored_key_{{loop.index0}}">
2024-06-27 15:06:05 +00:00
{{user['api_key'][:4]}}**...**{{user['api_key'][-4:]}}
2024-05-08 12:09:53 +00:00
</span>
<span id="uncensored_key_{{loop.index0}}" style="display: none;">
{{user['api_key']}}
</span>
</td>
<td>
<a class="btn btn-outline-info ml-3 px-1 py-0" href="{{ url_for('settings_b.new_token_user', user_id=user['id']) }}">
<i class="fas fa-random"></i>
</a>
<span class="btn btn-outline-secondary ml-1 px-1 py-0" id="btn_key_{{loop.index0}}" onclick="show_api_key({{loop.index0}})">
<i class="fas fa-eye"></i>
</span>
</td>
2024-06-27 15:06:05 +00:00
<td>
{% if user['2fa'] %}
{% if user['otp_setup'] %}
<span class="badge badge-success" style="font-size: 1.0rem;"><b>YES</b></span>
<a class="btn btn-outline-danger px-1 py-0" href="{{ url_for('settings_b.user_otp_reset', user_id=user['id']) }}">
<i class="fas fa-random"></i> Reset
</a>
{% else %}
<span class="badge badge-warning" style="font-size: 1.0rem;"><b>ENFORCED</b></span>
{% endif %}
<a class="btn btn-outline-danger px-1 py-0" href="{{ url_for('settings_b.user_otp_disable', user_id=user['id']) }}">
<i class="fas fa-times"></i>
</a>
{% else %}
<span class="badge badge-danger" style="font-size: 1.0rem;"><b>NO</b></span>
<a class="btn btn-outline-success px-1 py-0" href="{{ url_for('settings_b.user_otp_enable', user_id=user['id']) }}">
<i class="fas fa-plus"></i>
</a>
{% endif %}
</td>
2024-05-08 12:09:53 +00:00
<td>
<div class="d-flex justify-content-start">
<a class="btn btn-outline-primary ml-3 px-1 py-0" href="{{ url_for('settings_b.edit_user', user_id=user['id']) }}">
<i class="fas fa-pencil-alt"></i>
</a>
2024-05-08 12:09:53 +00:00
<a class="btn btn-outline-danger ml-3 px-1 py-0" href="{{ url_for('settings_b.delete_user', user_id=user['id']) }}">
<i class="fas fa-trash-alt"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-danger my-4" href="{{ url_for('settings_b.users_logout') }}">
<i class="fas fa-sign-out-alt"></i> Logout All Users
</a>
2024-05-08 12:09:53 +00:00
</div>
</div>
</div>
</body>
<script>
$(document).ready(function(){
$("#nav_users_list").addClass("active");
$("#nav_user_management").removeClass("text-muted");
$('#tableusers').DataTable({
"aLengthMenu": [[5, 10, 15, -1], [5, 10, 15, "All"]],
"iDisplayLength": 10,
"order": [[ 0, "asc" ]]
});
});
function toggle_sidebar(){
if($('#nav_menu').is(':visible')){
$('#nav_menu').hide();
$('#side_menu').removeClass('border-right')
$('#side_menu').removeClass('col-lg-2')
$('#core_content').removeClass('col-lg-10')
}else{
$('#nav_menu').show();
$('#side_menu').addClass('border-right')
$('#side_menu').addClass('col-lg-2')
$('#core_content').addClass('col-lg-10')
}
}
function show_api_key(key_id) {
$('#censored_key_' + key_id).hide();
$('#btn_key_' + key_id).hide();
$('#uncensored_key_' + key_id).show();
}
</script>
</html>