VPNManager/templates/main/index.html.ep
2024-07-19 20:06:19 +02:00

42 lines
1.6 KiB
Plaintext

% use Encode qw/encode decode/;
% my $users = stash 'users';
<html>
<head>
<link rel="stylesheet" href="/style.css"/>
</head>
<body class="main">
<h2>VPN Users</h2>
<p><a href="/vpn/create-user">Create new vpn user</a>.</p>
% if (defined $users && @$users) {
<ul>
% for my $user (@$users) {
<li>Id: <b><%=$user->id%></b> Name: <b><%=decode 'utf-8', $user->name%></b> Internal IP Address: <b><%=$user->ip_to_text%></b> <a href="/vpn/user/<%=$user->id%>/details">View details</a>
<form class="inline" method="post" action="/vpn/user/<%=$user->id%>/<%=$user->is_enabled ? 'disable' : 'enable'%>">
<input type="submit" value="<%=$user->is_enabled? 'Disable' : 'Enable'%>"/>
</form></li>
% }
% }
</ul>
<h2>Console whitelist</h2>
<h3>Add a user to the console whitelist</h3>
<form action="/whitelist/add" method="post">
<div>
<label for="name">Name</label>
<input name="username"/>
</div>
<input type="submit" value="Submit"/>
</form>
% my $whitelist_users = stash 'whitelist_users';
% if (defined $whitelist_users && @$whitelist_users) {
<h3>List of console users in whitelist</h3>
<ul>
% for my $user (@$whitelist_users) {
<li><%=$user->username%> <form class="inline" method="post" action="/whitelist/<%=$user->id%>/remove">
<input type="submit" value="Delete"/>
</form></li>
% }
</ul>
% }
</body>
</html>