Initial commit
This commit is contained in:
10
views/api.erb
Normal file
10
views/api.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= I18n.t('pages.api') %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<pre><%= ERB::Util.html_escape(File.read('docs/API.md')) %></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
69
views/config.erb
Normal file
69
views/config.erb
Normal file
@@ -0,0 +1,69 @@
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= I18n.t('views.install_server_title') %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text text-center"><%= I18n.t('views.install_server_description') %></p>
|
||||
<div class="container">
|
||||
<form id="cert-form" action="/install" method="POST" class="d-flex flex-column align-items-center">
|
||||
<div class="mb-3 w-100">
|
||||
<label for="cert-path" class="form-label"><%= I18n.t('views.cert_path_label') %></label>
|
||||
<input type="text" class="form-control w-100 required" id="cert-path" name="cert-path"
|
||||
placeholder="<%= I18n.t('views.enter_cert_path_placeholder') %>">
|
||||
</div>
|
||||
<div class="mb-3 w-100">
|
||||
<label for="validity-days" class="form-label"><%= I18n.t('views.cert_val_day') %></label>
|
||||
<input type="text" class="form-control w-100 required" id="validity-days" name="validity-days"
|
||||
placeholder="3650">
|
||||
</div>
|
||||
<div class="mb-3 w-100">
|
||||
<label for="country-name" class="form-label"><%= I18n.t('views.country_name_label') %></label>
|
||||
<input type="text" class="form-control w-100 required" id="country-name" name="country-name"
|
||||
placeholder="<%= I18n.t('views.enter_country_name_placeholder') %>">
|
||||
</div>
|
||||
<div class="mb-3 w-100">
|
||||
<label for="org-name" class="form-label"><%= I18n.t('views.org_name_label') %></label>
|
||||
<input type="text" class="form-control w-100 required" id="org-name" name="org-name"
|
||||
placeholder="<%= I18n.t('views.enter_org_name_placeholder') %>">
|
||||
</div>
|
||||
<div class="mb-3 w-100">
|
||||
<label for="common-name" class="form-label"><%= I18n.t('views.common_name_label') %></label>
|
||||
<input type="text" class="form-control w-100 required" id="common-name" name="common-name"
|
||||
placeholder="<%= I18n.t('views.enter_common_name_placeholder') %>">
|
||||
</div>
|
||||
<div class="mb-3 w-100">
|
||||
<label for="cert-password" class="form-label"><%= I18n.t('views.cert_password_label') %></label>
|
||||
<input type="password" class="form-control w-100 required" id="cert-password" name="cert-password"
|
||||
placeholder="<%= I18n.t('views.enter_cert_password_placeholder') %>">
|
||||
</div>
|
||||
<div class="d-flex justify-content-center w-100">
|
||||
<button type="button" class="btn btn-primary" id="submit-btn"><%= I18n.t('views.save') %></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#submit-btn').click(function () {
|
||||
var isValid = true;
|
||||
$('.required').each(function() {
|
||||
if ($(this).val() === '') {
|
||||
isValid = false;
|
||||
$(this).addClass('is-invalid');
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
if (isValid) {
|
||||
$('#cert-form').submit();
|
||||
} else {
|
||||
alert('<%= I18n.t('views.please_enter_all_required_fields') %>');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
6
views/errinfo.erb
Normal file
6
views/errinfo.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="card text-white mb-3 p-3">
|
||||
<div class="card-header bg-danger text-center"><%= ERB::Util.html_escape(@error) %></div>
|
||||
<div class="card-body text-black">
|
||||
<pre><%= ERB::Util.html_escape(@log) %></pre>
|
||||
</div>
|
||||
</div>
|
||||
10
views/info.erb
Normal file
10
views/info.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= @reason %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text text-center"><%= @info_descr %></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
61
views/layout.erb
Normal file
61
views/layout.erb
Normal file
@@ -0,0 +1,61 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title><%= @page_name %></title>
|
||||
<link rel="stylesheet" href="/js/bootstrap.min.css" />
|
||||
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/js/jquery-4.0.0.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<% if @menu %>
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="https://brepo.ru">brepo.ru</a>
|
||||
<span class="navbar-text pe-2 me-2 border-end"><%= I18n.t('views.user') %>: <%= session[:user].login %></span>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup"
|
||||
aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||
<div class="navbar-nav">
|
||||
<a class="nav-link
|
||||
<% if @page_name == I18n.t('pages.servers') %>
|
||||
active
|
||||
<% end %>" aria-current="page" href="/"><%= I18n.t('pages.servers') %></a>
|
||||
<a class="nav-link
|
||||
<% if @page_name == I18n.t('pages.clients') %>
|
||||
active
|
||||
<% end %>" aria-current="page" href="/clients"><%= I18n.t('pages.clients') %></a>
|
||||
<% if hasperms?('admin') %>
|
||||
<a class="nav-link
|
||||
<% if @page_name == I18n.t('pages.users') %>
|
||||
active
|
||||
<% end %>
|
||||
" href="/ulist"><%= I18n.t('pages.users') %></a>
|
||||
<% end %>
|
||||
<a class="nav-link <%= 'active' if @page_name == I18n.t('pages.api') %>" href="/apiinfo"><%= I18n.t('pages.api') %></a>
|
||||
<a class="nav-link <%= 'active' if @page_name == I18n.t('pages.root') %>" href="/root"><%= I18n.t('pages.root') %></a>
|
||||
<a class="nav-link" href="/logout"><%= I18n.t('views.logout') %></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<% end %>
|
||||
|
||||
<div class="container pb-5"></div>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
<div class="container pb-5"></div>
|
||||
|
||||
<div class="container-fluid text-center bg-light p-2">
|
||||
Made by BayRepo © 2026
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
245
views/list.erb
Normal file
245
views/list.erb
Normal file
@@ -0,0 +1,245 @@
|
||||
<% if hasperms?('creator') %>
|
||||
<div class="container p-3">
|
||||
<p class="d-inline-flex gap-1">
|
||||
<button class="btn btn-outline-success" type="button" data-bs-toggle="collapse" data-bs-target="#collapseForm" aria-expanded="false" aria-controls="collapseForm">
|
||||
<%= I18n.t('views.create_request_cert_button') %>
|
||||
</button>
|
||||
</p>
|
||||
<div class="collapse" id="collapseForm">
|
||||
<div class="card card-body">
|
||||
<form action="/addserver" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="domains" class="form-label"><%= I18n.t('views.domains_label') %></label>
|
||||
<input type="text" class="form-control" id="domains" name="domains" required placeholder="<%= I18n.t('views.domains_placeholder') %>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="validityDays" class="form-label"><%= I18n.t('views.validity_days_label') %></label>
|
||||
<input type="number" class="form-control" id="validityDays" name="validity_days" required value="365">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><%= I18n.t('views.request_cert_submit') %></button>
|
||||
<p class="mt-2"><%= I18n.t('views.request_cert_info') %></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="container">
|
||||
<ul class="nav nav-pills mb-3" id="liclist-tab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link
|
||||
<% if @tab == 0 %>
|
||||
active
|
||||
<% end %>
|
||||
" id="pills-slist-tab" data-bs-toggle="pill" data-bs-target="#pills-slist"
|
||||
type="button" role="tab" aria-controls="pills-slist"
|
||||
<% if @tab == 0 %>
|
||||
aria-selected="true"
|
||||
<% else %>
|
||||
aria-selected="false"
|
||||
<% end %>
|
||||
>
|
||||
<%= I18n.t('views.server_certs_tab') %>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link
|
||||
<% if @tab == 1 %>
|
||||
active
|
||||
<% end %>
|
||||
" id="pills-clist-tab" data-bs-toggle="pill" data-bs-target="#pills-clist"
|
||||
type="button" role="tab" aria-controls="pills-clist"
|
||||
<% if @tab == 0 %>
|
||||
aria-selected="false" disabled
|
||||
<% else %>
|
||||
aria-selected="true"
|
||||
<% end %>
|
||||
>
|
||||
<%= I18n.t('views.selected_cert_info_tab') %>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="liclist-tabContent">
|
||||
<div class="tab-pane fade
|
||||
<% if @tab == 0 %>
|
||||
show active
|
||||
<% end %>
|
||||
" id="pills-slist" role="tabpanel" aria-labelledby="pills-slist-tab" tabindex="0">
|
||||
<div class="container text-center">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><%= I18n.t('views.status_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.id_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.date_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.revoke_date_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.info_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.actions_header') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @list_serv.each do |item| %>
|
||||
<tr
|
||||
<% if item[:status] != 'V' %>
|
||||
class="table-danger"
|
||||
<% elsif item[:expired] %>
|
||||
class="table-warning"
|
||||
<% end %>
|
||||
>
|
||||
<td><%= item[:status] %></td>
|
||||
<td><%= item[:id] %></td>
|
||||
<td><%= item[:date] %></td>
|
||||
<td><%= item[:revoke_date] %></td>
|
||||
<td>CN=<%= item[:ui][:CN] %>, O=<%= item[:ui][:O] %></td>
|
||||
<td>
|
||||
<% if hasperms?('creator') %>
|
||||
<a href="/revoke/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.revoke_cert_tooltip') %>" class="icon-link revoke-cert">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
||||
fill="currentColor" class="bi bi-sign-stop" viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M3.16 10.08c-.931 0-1.447-.493-1.494-1.132h.653c.065.346.396.583.891.583.524 0 .83-.246.83-.62 0-.303-.203-.467-.637-.572l-.656-.164c-.61-.147-.978-.51-.978-1.078 0-.706.597-1.184 1.444-1.184.853 0 1.386.475 1.436 1.087h-.645c-.064-.32-.352-.542-.797-.542-.472 0-.77.246-.77.6 0 .261.196.437.553.522l.654.161c.673.164 1.06.487 1.06 1.11 0 .736-.574 1.228-1.544 1.228Zm3.427-3.51V10h-.665V6.57H4.753V6h3.006v.568H6.587Z" />
|
||||
<path fill-rule="evenodd"
|
||||
d="M11.045 7.73v.544c0 1.131-.636 1.805-1.661 1.805-1.026 0-1.664-.674-1.664-1.805V7.73c0-1.136.638-1.807 1.664-1.807s1.66.674 1.66 1.807Zm-.674.547v-.553c0-.827-.422-1.234-.987-1.234-.572 0-.99.407-.99 1.234v.553c0 .83.418 1.237.99 1.237.565 0 .987-.408.987-1.237m1.15-2.276h1.535c.82 0 1.316.55 1.316 1.292 0 .747-.501 1.289-1.321 1.289h-.865V10h-.665zm1.436 2.036c.463 0 .735-.272.735-.744s-.272-.741-.735-.741h-.774v1.485z" />
|
||||
<path fill-rule="evenodd"
|
||||
d="M4.893 0a.5.5 0 0 0-.353.146L.146 4.54A.5.5 0 0 0 0 4.893v6.214a.5.5 0 0 0 .146.353l4.394 4.394a.5.5 0 0 0 .353.146h6.214a.5.5 0 0 0 .353-.146l4.394-4.394a.5.5 0 0 0 .146-.353V4.893a.5.5 0 0 0-.146-.353L11.46.146A.5.5 0 0 0 11.107 0zM1 5.1 5.1 1h5.8L15 5.1v5.8L10.9 15H5.1L1 10.9z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/download/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.download_cert_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-file-earmark-arrow-down" viewBox="0 0 16 16">
|
||||
<path d="M8.5 6.5a.5.5 0 0 0-1 0v3.793L6.354 9.146a.5.5 0 1 0-.708.708l2 2a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0-.708-.708L8.5 10.293z"/>
|
||||
<path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2M9.5 3A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z"/>
|
||||
</svg>
|
||||
</a>
|
||||
<% end %>
|
||||
<a href="/shows/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.view_cert_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
||||
fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8M1.173 8a13 13 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5s3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5s-3.879-1.168-5.168-2.457A13 13 0 0 1 1.172 8z" />
|
||||
<path
|
||||
d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0" />
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/clients/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.view_clients_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-funnel" viewBox="0 0 16 16">
|
||||
<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2z"/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="container text-centered">
|
||||
<nav>
|
||||
<ul class="pagination pagination-sm">
|
||||
<% @pages.each do |item| %>
|
||||
<li class="page-item
|
||||
<% if item[:is_current] %>
|
||||
active
|
||||
<% end %>
|
||||
">
|
||||
<a class="page-link" aria-current="page"
|
||||
<% unless item[:is_current] %>
|
||||
href="/?p=<%= item[:page] %>"
|
||||
<% end %>><%= item[:page] %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade
|
||||
<% if @tab == 1 %>
|
||||
show active
|
||||
<% end %>
|
||||
" id="pills-clist" role="tabpanel" aria-labelledby="pills-clist-tab" tabindex="0">
|
||||
<% if @tab == 1 %>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= @cert_info[:name] %> id: <%= @cert_info[:id] %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><%= I18n.t('views.cert_info_card_title') %></h5>
|
||||
<div class="card">
|
||||
<div class="card-body overflow-x-auto">
|
||||
<pre>
|
||||
<%= @cert_info[:common] %>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<h5 class="card-title"><%= I18n.t('views.revoke_info_card_title') %></h5>
|
||||
<div class="card">
|
||||
<div class="card-body overflow-x-auto">
|
||||
<pre>
|
||||
<%= @cert_info[:revoke] %>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<% if hasperms?('creator') %>
|
||||
<h5 class="card-title"><%= I18n.t('views.additional_actions') %></h5>
|
||||
<div class="card">
|
||||
<p><%= I18n.t('views.download_cert_tooltip') %>
|
||||
<a href="/download/<%= ERB::Util.url_encode(@cert_info[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.download_cert_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-file-earmark-arrow-down" viewBox="0 0 16 16">
|
||||
<path d="M8.5 6.5a.5.5 0 0 0-1 0v3.793L6.354 9.146a.5.5 0 1 0-.708.708l2 2a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0-.708-.708L8.5 10.293z"/>
|
||||
<path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2M9.5 3A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z"/>
|
||||
</svg>
|
||||
</a>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
Nothing
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="confirmModal" class="modal fade" tabindex="-1" aria-labelledby="confirmModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="confirmModalLabel"><%= I18n.t('views.modal_title_confirm') %></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><%= I18n.t('views.modal_body_confirm_revoke') %></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="revokeButton" class="btn btn-danger"><%= I18n.t('views.revoke_button') %></button>
|
||||
<button type="button" id="cancelButton" class="btn btn-secondary" data-bs-dismiss="modal"><%= I18n.t('views.modal_btn_cancel') %></button>
|
||||
<input type="hidden" value="" id="modal-redirect-url"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||||
$('.revoke-cert').click(function(event) {
|
||||
event.preventDefault(); // Prevent the default action (navigation)
|
||||
var href = $(this).attr('href'); // Get the value of data-href
|
||||
if (href) {
|
||||
$('#modal-redirect-url').val(href);
|
||||
$('#confirmModal').modal('show'); // Show the modal
|
||||
}
|
||||
});
|
||||
|
||||
$('#cancelButton').click(function() {
|
||||
$('#confirmModal').modal('hide'); // Hide the modal when "Cancel" is clicked
|
||||
});
|
||||
|
||||
$('#revokeButton').click(function() {
|
||||
var redirectUrl = $('#modal-redirect-url').val(); // Get the saved URL
|
||||
if (redirectUrl) {
|
||||
window.location.href = redirectUrl; // Redirect to the saved URL
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
371
views/listc.erb
Normal file
371
views/listc.erb
Normal file
@@ -0,0 +1,371 @@
|
||||
<% if hasperms?('creator') %>
|
||||
<div class="container p-3">
|
||||
<p class="d-inline-flex gap-1">
|
||||
<button class="btn btn-outline-warning" type="button" data-bs-toggle="collapse" data-bs-target="#collapseForm" aria-expanded="false" aria-controls="collapseForm">
|
||||
<%= I18n.t('views.create_request_cert_button') %>
|
||||
</button>
|
||||
</p>
|
||||
<div class="collapse" id="collapseForm">
|
||||
<div class="card card-body">
|
||||
<form action="/addclient" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="server_domain" class="form-label"><%= I18n.t('views.server_access_label') %></label>
|
||||
<select class="form-select" aria-label="<%= I18n.t('views.server_access_label') %>" id="server_domain" name="server_domain" required>
|
||||
<% fst = true %>
|
||||
<% @list_servers_full.each do |item| %>
|
||||
<% if fst == true %>
|
||||
<% fst = false %>
|
||||
<option value="<%= item %>"selected><%= item %></option>
|
||||
<% else %>
|
||||
<option value="<%= item %>"><%= item %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="client" class="form-label"><%= I18n.t('views.client_name_email_label') %></label>
|
||||
<input type="text" class="form-control" id="client" name="client" required placeholder="<%= I18n.t('views.client_placeholder') %>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="validityDays" class="form-label"><%= I18n.t('views.validity_days_label') %></label>
|
||||
<input type="number" class="form-control" id="validityDays" name="validity_days" required value="365">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><%= I18n.t('views.request_cert_submit') %></button>
|
||||
<p class="mt-2"><%= I18n.t('views.request_cert_info') %></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="container">
|
||||
<ul class="nav nav-pills mb-3" id="liclist-tab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link
|
||||
<% if @tab == 0 %>
|
||||
active
|
||||
<% end %>
|
||||
" id="pills-slist-tab" data-bs-toggle="pill" data-bs-target="#pills-slist"
|
||||
type="button" role="tab" aria-controls="pills-slist"
|
||||
<% if @tab == 0 %>
|
||||
aria-selected="true"
|
||||
<% else %>
|
||||
aria-selected="false"
|
||||
<% end %>
|
||||
>
|
||||
<%= I18n.t('views.list_clients_tab') %>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link
|
||||
<% if @tab == 1 %>
|
||||
active
|
||||
<% end %>
|
||||
" id="pills-clist-tab" data-bs-toggle="pill" data-bs-target="#pills-clist"
|
||||
type="button" role="tab" aria-controls="pills-clist"
|
||||
<% if @tab == 1 %>
|
||||
aria-selected="true"
|
||||
<% else %>
|
||||
aria-selected="false" disabled
|
||||
<% end %>
|
||||
>
|
||||
<%= I18n.t('views.filtered_certs_tab') %>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link
|
||||
<% if @tab == 2 %>
|
||||
active
|
||||
<% end %>
|
||||
" id="pills-ilist-tab" data-bs-toggle="pill" data-bs-target="#pills-ilist"
|
||||
type="button" role="tab" aria-controls="pills-ilist"
|
||||
<% if @tab == 2 %>
|
||||
aria-selected="true"
|
||||
<% else %>
|
||||
aria-selected="false" disabled
|
||||
<% end %>
|
||||
>
|
||||
<%= I18n.t('views.selected_cert_info_tab') %>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="liclist-tabContent">
|
||||
<div class="tab-pane fade
|
||||
<% if @tab == 0 %>
|
||||
show active
|
||||
<% end %>
|
||||
" id="pills-slist" role="tabpanel" aria-labelledby="pills-slist-tab"
|
||||
tabindex="0">
|
||||
<div class="container text-center">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><%= I18n.t('views.status_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.id_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.date_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.revoke_date_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.info_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.actions_header') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @list_clients.each do |item| %>
|
||||
<tr
|
||||
<% if item[:status] != 'V' %>
|
||||
class="table-danger"
|
||||
<% elsif item[:expired] %>
|
||||
class="table-warning"
|
||||
<% end %>
|
||||
>
|
||||
<td><%= item[:status] %></td>
|
||||
<td><%= item[:id] %></td>
|
||||
<td><%= item[:date] %></td>
|
||||
<td><%= item[:revoke_date] %></td>
|
||||
<td>CN=<%= item[:ui][:CN] %>, O=<%= item[:ui][:O] %></td>
|
||||
<td>
|
||||
<% if hasperms?('creator') %>
|
||||
<a href="/revoke/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.revoke_cert_tooltip') %>" class="icon-link revoke-cert">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
||||
fill="currentColor" class="bi bi-sign-stop" viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M3.16 10.08c-.931 0-1.447-.493-1.494-1.132h.653c.065.346.396.583.891.583.524 0 .83-.246.83-.62 0-.303-.203-.467-.637-.572l-.656-.164c-.61-.147-.978-.51-.978-1.078 0-.706.597-1.184 1.444-1.184.853 0 1.386.475 1.436 1.087h-.645c-.064-.32-.352-.542-.797-.542-.472 0-.77.246-.77.6 0 .261.196.437.553.522l.654.161c.673.164 1.06.487 1.06 1.11 0 .736-.574 1.228-1.544 1.228Zm3.427-3.51V10h-.665V6.57H4.753V6h3.006v.568H6.587Z" />
|
||||
<path fill-rule="evenodd"
|
||||
d="M11.045 7.73v.544c0 1.131-.636 1.805-1.661 1.805-1.026 0-1.664-.674-1.664-1.805V7.73c0-1.136.638-1.807 1.664-1.807s1.66.674 1.66 1.807Zm-.674.547v-.553c0-.827-.422-1.234-.987-1.234-.572 0-.99.407-.99 1.234v.553c0 .83.418 1.237.99 1.237.565 0 .987-.408.987-1.237m1.15-2.276h1.535c.82 0 1.316.55 1.316 1.292 0 .747-.501 1.289-1.321 1.289h-.865V10h-.665zm1.436 2.036c.463 0 .735-.272.735-.744s-.272-.741-.735-.741h-.774v1.485z" />
|
||||
<path fill-rule="evenodd"
|
||||
d="M4.893 0a.5.5 0 0 0-.353.146L.146 4.54A.5.5 0 0 0 0 4.893v6.214a.5.5 0 0 0 .146.353l4.394 4.394a.5.5 0 0 0 .353.146h6.214a.5.5 0 0 0 .353-.146l4.394-4.394a.5.5 0 0 0 .146-.353V4.893a.5.5 0 0 0-.146-.353L11.46.146A.5.5 0 0 0 11.107 0zM1 5.1 5.1 1h5.8L15 5.1v5.8L10.9 15H5.1L1 10.9z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/download/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.download_cert_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-file-earmark-arrow-down" viewBox="0 0 16 16">
|
||||
<path d="M8.5 6.5a.5.5 0 0 0-1 0v3.793L6.354 9.146a.5.5 0 1 0-.708.708l2 2a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0-.708-.708L8.5 10.293z"/>
|
||||
<path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2M9.5 3A1.5.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z"/>
|
||||
</svg>
|
||||
</a>
|
||||
<% end %>
|
||||
<a href="/showc/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.view_cert_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
||||
fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8M1.173 8a13 13 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5s3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5s-3.879-1.168-5.168-2.457A13 13 0 0 1 1.172 8z" />
|
||||
<path
|
||||
d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0" />
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/clients/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.view_clients_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-funnel" viewBox="0 0 16 16">
|
||||
<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2z"/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="container text-centered">
|
||||
<nav>
|
||||
<ul class="pagination pagination-sm">
|
||||
<% @pages.each do |item| %>
|
||||
<li class="page-item
|
||||
<% if item[:is_current] %>
|
||||
active
|
||||
<% end %>
|
||||
">
|
||||
<a class="page-link" aria-current="page"
|
||||
<% unless item[:is_current] %>
|
||||
href="/clients?p=<%= item[:page] %>"
|
||||
<% end %>><%= item[:page] %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade
|
||||
<% if @tab == 1 %>
|
||||
show active
|
||||
<% end %>
|
||||
" id="pills-clist" role="tabpanel" aria-labelledby="pills-clist-tab" tabindex="0">
|
||||
<% if @tab == 1 %>
|
||||
<div class="container text-center">
|
||||
<p><%= @server_name %>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><%= I18n.t('views.status_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.id_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.date_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.revoke_date_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.info_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.actions_header') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @list_clients_short.each do |item| %>
|
||||
<tr
|
||||
<% if item[:status] != 'V' %>
|
||||
class="table-danger"
|
||||
<% elsif item[:expired] %>
|
||||
class="table-warning"
|
||||
<% end %>
|
||||
>
|
||||
<td><%= item[:status] %></td>
|
||||
<td><%= item[:id] %></td>
|
||||
<td><%= item[:date] %></td>
|
||||
<td><%= item[:revoke_date] %></td>
|
||||
<td>CN=<%= item[:ui][:CN] %>, O=<%= item[:ui][:O] %></td>
|
||||
<td>
|
||||
<% if hasperms?('creator') %>
|
||||
<a href="/revoke/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.revoke_cert_tooltip') %>" class="icon-link revoke-cert">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
||||
fill="currentColor" class="bi bi-sign-stop" viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M3.16 10.08c-.931 0-1.447-.493-1.494-1.132h.653c.065.346.396.583.891.583.524 0 .83-.246.83-.62 0-.303-.203-.467-.637-.572l-.656-.164c-.61-.147-.978-.51-.978-1.078 0-.706.597-1.184 1.444-1.184.853 0 1.386.475 1.436 1.087h-.645c-.064-.32-.352-.542-.797-.542-.472 0-.77.246-.77.6 0 .261.196.437.553.522l.654.161c.673.164 1.06.487 1.06 1.11 0 .736-.574 1.228-1.544 1.228Zm3.427-3.51V10h-.665V6.57H4.753V6h3.006v.568H6.587Z" />
|
||||
<path fill-rule="evenodd"
|
||||
d="M11.045 7.73v.544c0 1.131-.636 1.805-1.661 1.805-1.026 0-1.664-.674-1.664-1.805V7.73c0-1.136.638-1.807 1.664-1.807s1.66.674 1.66 1.807Zm-.674.547v-.553c0-.827-.422-1.234-.987-1.234-.572 0-.99.407-.99 1.234v.553c0 .83.418 1.237.99 1.237.565 0 .987-.408.987-1.237m1.15-2.276h1.535c.82 0 1.316.55 1.316 1.292 0 .747-.501 1.289-1.321 1.289h-.865V10h-.665zm1.436 2.036c.463 0 .735-.272.735-.744s-.272-.741-.735-.741h-.774v1.485z" />
|
||||
<path fill-rule="evenodd"
|
||||
d="M4.893 0a.5.5 0 0 0-.353.146L.146 4.54A.5.5 0 0 0 0 4.893v6.214a.5.5 0 0 0 .146.353l4.394 4.394a.5.5 0 0 0 .353.146h6.214a.5.5 0 0 0 .353-.146l4.394-4.394a.5.5 0 0 0 .146-.353V4.893a.5.5 0 0 0-.146-.353L11.46.146A.5.5 0 0 0 11.107 0zM1 5.1 5.1 1h5.8L15 5.1v5.8L10.9 15H5.1L1 10.9z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/download/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.download_cert_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-file-earmark-arrow-down" viewBox="0 0 16 16">
|
||||
<path d="M8.5 6.5a.5.5 0 0 0-1 0v3.793L6.354 9.146a.5.5 0 1 0-.708.708l2 2a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0-.708-.708L8.5 10.293z"/>
|
||||
<path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2M9.5 3A1.5.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z"/>
|
||||
</svg>
|
||||
</a>
|
||||
<% end %>
|
||||
<a href="/showc/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.view_cert_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
||||
fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
|
||||
<path
|
||||
d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8M1.173 8a13 13 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5s3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5s-3.879-1.168-5.168-2.457A13 13 0 0 1 1.172 8z" />
|
||||
<path
|
||||
d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0" />
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/clients/<%= ERB::Util.url_encode(item[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.view_clients_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-funnel" viewBox="0 0 16 16">
|
||||
<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2z"/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="container text-centered">
|
||||
<nav>
|
||||
<ul class="pagination pagination-sm">
|
||||
<% @pages_short.each do |item| %>
|
||||
<li class="page-item
|
||||
<% if item[:is_current] %>
|
||||
active
|
||||
<% end %>
|
||||
">
|
||||
<a class="page-link" aria-current="page"
|
||||
<% unless item[:is_current] %>
|
||||
href="/clients/<%= @id %>?fp=<%= item[:page] %>"
|
||||
<% end %>><%= item[:page] %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
Nothing
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="tab-pane fade
|
||||
<% if @tab == 2 %>
|
||||
show active
|
||||
<% end %>
|
||||
" id="pills-ilist" role="tabpanel" aria-labelledby="pills-ilist-tab" tabindex="0">
|
||||
<% if @tab == 2 %>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= @cert_info[:name] %> id: <%= @cert_info[:id] %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><%= I18n.t('views.cert_info_card_title') %></h5>
|
||||
<div class="card">
|
||||
<div class="card-body overflow-x-auto">
|
||||
<pre>
|
||||
<%= @cert_info[:common] %>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<h5 class="card-title"><%= I18n.t('views.revoke_info_card_title') %></h5>
|
||||
<div class="card">
|
||||
<div class="card-body overflow-x-auto">
|
||||
<pre>
|
||||
<%= @cert_info[:revoke] %>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<% if hasperms?('creator') %>
|
||||
<h5 class="card-title"><%= I18n.t('views.additional_actions') %></h5>
|
||||
<div class="card">
|
||||
<p><%= I18n.t('views.download_cert_tooltip') %>
|
||||
<a href="/download/<%= ERB::Util.url_encode(@cert_info[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.download_cert_tooltip') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-file-earmark-arrow-down" viewBox="0 0 16 16">
|
||||
<path d="M8.5 6.5a.5.5 0 0 0-1 0v3.793L6.354 9.146a.5.5 0 1 0-.708.708l2 2a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0-.708-.708L8.5 10.293z"/>
|
||||
<path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2M9.5 3A1.5.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z"/>
|
||||
</svg>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
Nothing
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="confirmModal" class="modal fade" tabindex="-1" aria-labelledby="confirmModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="confirmModalLabel"><%= I18n.t('views.modal_title_confirm') %></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><%= I18n.t('views.modal_body_confirm_revoke') %></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="revokeButton" class="btn btn-danger"><%= I18n.t('views.revoke_button') %></button>
|
||||
<button type="button" id="cancelButton" class="btn btn-secondary" data-bs-dismiss="modal"><%= I18n.t('views.modal_btn_cancel') %></button>
|
||||
<input type="hidden" value="" id="modal-redirect-url"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||||
$('.revoke-cert').click(function(event) {
|
||||
event.preventDefault(); // Prevent the default action (navigation)
|
||||
var href = $(this).attr('href'); // Get the value of data-href
|
||||
if (href) {
|
||||
$('#modal-redirect-url').val(href);
|
||||
$('#confirmModal').modal('show'); // Show the modal
|
||||
}
|
||||
});
|
||||
|
||||
$('#cancelButton').click(function() {
|
||||
$('#confirmModal').modal('hide'); // Hide the modal when "Cancel" is clicked
|
||||
});
|
||||
|
||||
$('#revokeButton').click(function() {
|
||||
var redirectUrl = $('#modal-redirect-url').val(); // Get the saved URL
|
||||
if (redirectUrl) {
|
||||
window.location.href = redirectUrl; // Redirect to the saved URL
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
51
views/login.erb
Normal file
51
views/login.erb
Normal file
@@ -0,0 +1,51 @@
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= I18n.t('views.authorize') %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<% unless @error.nil? %>
|
||||
<div class="alert alert-danger" role="alert"><%= @error %></div>
|
||||
<% end %>
|
||||
<div class="container">
|
||||
<form id="login-form" action="/login" method="POST" class="d-flex flex-column align-items-center">
|
||||
<div class="mb-3 w-100">
|
||||
<label for="login" class="form-label"><%= I18n.t('views.user_name') %></label>
|
||||
<input type="text" class="form-control w-100 required" id="login" name="login"
|
||||
placeholder="<%= I18n.t('views.enter_login') %>">
|
||||
</div>
|
||||
<div class="mb-3 w-100">
|
||||
<label for="password" class="form-label"><%= I18n.t('views.password') %></label>
|
||||
<input type="password" class="form-control w-100 required" id="password" name="password"
|
||||
placeholder="<%= I18n.t('views.enter_password') %>">
|
||||
</div>
|
||||
<div class="d-flex justify-content-center w-100">
|
||||
<button type="button" class="btn btn-primary" id="submit-btn"><%= I18n.t('views.authorize') %></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#submit-btn').click(function () {
|
||||
var isValid = true;
|
||||
$('.required').each(function() {
|
||||
if ($(this).val() === '') {
|
||||
isValid = false;
|
||||
$(this).addClass('is-invalid');
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
if (isValid) {
|
||||
$('#login-form').submit();
|
||||
} else {
|
||||
alert('<%= I18n.t('views.please_enter_all_required_fields') %>');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
10
views/perms.erb
Normal file
10
views/perms.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= @reason %>!!!
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-danger text-center" role="alert"><%= @info_descr %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
23
views/root.erb
Normal file
23
views/root.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= @cert_info[:name] %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><%= I18n.t('views.certificate_information') %></h5>
|
||||
<div class="card">
|
||||
<div class="card-body overflow-x-auto">
|
||||
<pre>
|
||||
<%= @cert_info[:common] %>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<h5 class="card-title"><%= I18n.t('views.revoke_information') %></h5>
|
||||
<div class="card">
|
||||
<div class="card-body overflow-x-auto">
|
||||
<pre>
|
||||
<%= @cert_info[:revoke] %>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
240
views/ulist.erb
Normal file
240
views/ulist.erb
Normal file
@@ -0,0 +1,240 @@
|
||||
<div class="container p-3">
|
||||
<p class="d-inline-flex gap-1">
|
||||
<button class="btn btn-outline-success" type="button" data-bs-toggle="collapse" data-bs-target="#collapseFormUser" aria-expanded="false" aria-controls="collapseFormUser">
|
||||
<%= I18n.t('views.create_user_button') %>
|
||||
</button>
|
||||
</p>
|
||||
<div class="collapse" id="collapseFormUser">
|
||||
<div class="card card-body">
|
||||
<form action="/adduser" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="login" class="form-label"><%= I18n.t('views.login_label') %></label>
|
||||
<input type="text" class="form-control" id="login" name="login" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label"><%= I18n.t('views.password_label') %></label>
|
||||
<input type="password" class="form-control" id="password" name="password" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label"><%= I18n.t('views.email_label') %></label>
|
||||
<input type="email" class="form-control" id="email" name="email">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label"><%= I18n.t('views.role_label') %></label>
|
||||
<select class="form-select" id="role" name="role">
|
||||
<option value="0" selected><%= I18n.t('views.role_user') %></option>
|
||||
<option value="1"><%= I18n.t('views.role_creator') %></option>
|
||||
<option value="2"><%= I18n.t('views.role_admin') %></option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><%= I18n.t('views.submit_create_user') %></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<ul class="nav nav-pills mb-3" id="userlist-tab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link
|
||||
<% if @tab == 0 %>
|
||||
active
|
||||
<% end %>
|
||||
" id="pills-ulist-tab" data-bs-toggle="pill" data-bs-target="#pills-ulist" type="button" role="tab" aria-controls="pills-ulist"
|
||||
<% if @tab == 0 %>
|
||||
aria-selected="true"
|
||||
<% else %>
|
||||
aria-selected="false"
|
||||
<% end %>
|
||||
>
|
||||
<%= I18n.t('views.user_list_tab') %>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link
|
||||
<% if @tab == 1 %>
|
||||
active
|
||||
<% end %>
|
||||
" id="pills-edit-tab" data-bs-toggle="pill" data-bs-target="#pills-edit" type="button" role="tab" aria-controls="pills-edit"
|
||||
<% if @tab == 1 %>
|
||||
aria-selected="true"
|
||||
<% else %>
|
||||
aria-selected="false" disabled
|
||||
<% end %>
|
||||
>
|
||||
<%= I18n.t('views.edit_user_tab') %>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="userlist-tabContent">
|
||||
<div class="tab-pane fade
|
||||
<% if @tab == 0 %>
|
||||
show active
|
||||
<% end %>
|
||||
" id="pills-ulist" role="tabpanel" aria-labelledby="pills-ulist-tab" tabindex="0">
|
||||
<div class="container text-center">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><%= I18n.t('views.user_name_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.role_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.email_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.created_at_header') %></th>
|
||||
<th scope="col"><%= I18n.t('views.actions_header') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @users.each do |user| %>
|
||||
<tr>
|
||||
<td><%= user[:login] %></td>
|
||||
<td>
|
||||
<%= case user[:role]
|
||||
when 0 then I18n.t('views.role_user')
|
||||
when 1 then I18n.t('views.role_creator')
|
||||
when 2 then I18n.t('views.role_admin')
|
||||
else I18n.t('views.role_unknown')
|
||||
end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if user[:email].nil? || user[:email].strip == '' %>
|
||||
<%= I18n.t('views.no_email') %>
|
||||
<% else %>
|
||||
<%= user[:email] %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= user[:create_at].strftime('%Y-%m-%d') %></td>
|
||||
<td>
|
||||
<a href="/edituser/<%= ERB::Util.url_encode(user[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.edit_user_tab') %>" class="icon-link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pen" viewBox="0 0 16 16">
|
||||
<path d="m13.498.795.149-.149a1.207 1.207 0 1 1 1.707 1.708l-.149.148a1.5 1.5 0 0 1-.059 2.059L4.854 14.854a.5.5 0 0 1-.233.131l-4 1a.5.5 0 0 1-.606-.606l1-4a.5.5 0 0 1 .131-.232l9.642-9.642a.5.5 0 0 0-.642.056L6.854 4.854a.5.5 0 1 1-.708-.708L9.44.854A1.5 1.5 0 0 1 11.5.796a1.5 1.5 0 0 1 1.998-.001m-.644.766a.5.5 0 0 0-.707 0L1.95 11.756l-.764 3.057 3.057-.764L14.44 3.854a.5.5 0 0 0 0-.708z"/>
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/deleteuser/<%= ERB::Util.url_encode(user[:id]) %>" data-bs-toggle="tooltip" data-bs-title="<%= I18n.t('views.delete_user') %>" class="icon-link revoke-cert">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash3" viewBox="0 0 16 16">
|
||||
<path d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5M11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47M8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5"/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="container text-centered">
|
||||
<nav>
|
||||
<ul class="pagination pagination-sm">
|
||||
<% @pages.each do |item| %>
|
||||
<li class="page-item
|
||||
<% if item[:is_current] %>
|
||||
active
|
||||
<% end %>"
|
||||
>
|
||||
<a class="page-link" aria-current="page" href="/users?p=<%= item[:page] %>">
|
||||
<%= item[:page] %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade
|
||||
<% if @tab == 1 %>
|
||||
show active
|
||||
<% end %>
|
||||
" id="pills-edit" role="tabpanel" aria-labelledby="pills-edit-tab" tabindex="0">
|
||||
<% if @tab == 1 %>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<%= I18n.t('views.card_header_edit_user') %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="/edituser/<%= @selected_user[:id] %>" method="post" id="editUserForm">
|
||||
<input type="hidden" name="id" value="<%= @selected_user[:id] %>">
|
||||
<div class="mb-3">
|
||||
<label for="login" class="form-label"><%= I18n.t('views.login_label') %></label>
|
||||
<input type="text" class="form-control" id="login" name="login" value="<%= @selected_user[:login] %>" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label"><%= I18n.t('views.password_label') %></label>
|
||||
<input type="password" class="form-control" id="password" name="password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label"><%= I18n.t('views.email_label') %></label>
|
||||
<input type="email" class="form-control" id="email" name="email" value="<%= @selected_user[:email] %>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label"><%= I18n.t('views.role_label') %></label>
|
||||
<select class="form-select" id="role" name="role">
|
||||
<% if @selected_user[:role] == 0 %>
|
||||
<option value="0" selected><%= I18n.t('views.role_user') %></option>
|
||||
<% else %>
|
||||
<option value="0"><%= I18n.t('views.role_user') %></option>
|
||||
<% end %>
|
||||
<% if @selected_user[:role] == 1 %>
|
||||
<option value="1" selected><%= I18n.t('views.role_creator') %></option>
|
||||
<% else %>
|
||||
<option value="1"><%= I18n.t('views.role_creator') %></option>
|
||||
<% end %>
|
||||
<% if @selected_user[:role] == 2 %>
|
||||
<option value="2" selected><%= I18n.t('views.role_admin') %></option>
|
||||
<% else %>
|
||||
<option value="2"><%= I18n.t('views.role_admin') %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><%= I18n.t('views.submit_update_user') %></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
Nothing
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="confirmModal" class="modal fade" tabindex="-1" aria-labelledby="confirmModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="confirmModalLabel"><%= I18n.t('views.modal_title_confirm') %></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><%= I18n.t('views.modal_body_confirm') %></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="revokeButton" class="btn btn-danger"><%= I18n.t('views.modal_btn_delete') %></button>
|
||||
<button type="button" id="cancelButton" class="btn btn-secondary" data-bs-dismiss="modal"><%= I18n.t('views.modal_btn_cancel') %></button>
|
||||
<input type="hidden" value="" id="modal-redirect-url"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||||
$('.revoke-cert').click(function(event) {
|
||||
event.preventDefault(); // Prevent the default action (navigation)
|
||||
var href = $(this).attr('href'); // Get the value of data-href
|
||||
if (href) {
|
||||
$('#modal-redirect-url').val(href);
|
||||
$('#confirmModal').modal('show'); // Show the modal
|
||||
}
|
||||
});
|
||||
|
||||
$('#cancelButton').click(function() {
|
||||
$('#confirmModal').modal('hide'); // Hide the modal when "Cancel" is clicked
|
||||
});
|
||||
|
||||
$('#revokeButton').click(function() {
|
||||
var redirectUrl = $('#modal-redirect-url').val(); // Get the saved URL
|
||||
if (redirectUrl) {
|
||||
window.location.href = redirectUrl; // Redirect to the saved URL
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user