|
@@ -7,13 +7,6 @@
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css">
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css">
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.dataTables.min.css">
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.dataTables.min.css">
|
|
- <style>
|
|
|
|
- .password-blur {
|
|
|
|
- filter: blur(4px);
|
|
|
|
- transition: filter 0.3s ease;
|
|
|
|
- cursor: pointer;
|
|
|
|
- }
|
|
|
|
- </style>
|
|
|
|
</head>
|
|
</head>
|
|
<body>
|
|
<body>
|
|
<!-- Navbar -->
|
|
<!-- Navbar -->
|
|
@@ -31,6 +24,20 @@
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</nav>
|
|
|
|
|
|
|
|
+ <!-- Sub-navigation for Accounts -->
|
|
|
|
+ <div class="bg-light py-2">
|
|
|
|
+ <div class="container">
|
|
|
|
+ <ul class="nav nav-pills">
|
|
|
|
+ <li class="nav-item">
|
|
|
|
+ <a class="nav-link active" href="/accounts">List Accounts</a>
|
|
|
|
+ </li>
|
|
|
|
+ <li class="nav-item">
|
|
|
|
+ <a class="nav-link" href="/accounts/add">Add Account</a>
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<!-- Main Content -->
|
|
<!-- Main Content -->
|
|
<div class="container mt-5">
|
|
<div class="container mt-5">
|
|
<h2>{{ username }}'s Accounts</h2>
|
|
<h2>{{ username }}'s Accounts</h2>
|
|
@@ -55,11 +62,15 @@
|
|
<td>{{ account.stream }}</td>
|
|
<td>{{ account.stream }}</td>
|
|
<td><a href="{{ account.streamURL }}" target="_blank">{{ account.streamURL }}</a></td>
|
|
<td><a href="{{ account.streamURL }}" target="_blank">{{ account.streamURL }}</a></td>
|
|
<td>{{ account.expiaryDate_rendered }}</td>
|
|
<td>{{ account.expiaryDate_rendered }}</td>
|
|
- <td class="password-cell password-blur" data-password="{{ account.password }}">********</td>
|
|
|
|
|
|
+ <td>{{ account.password }}</td>
|
|
<td>
|
|
<td>
|
|
- <button class="btn btn-danger delete-account-btn" data-stream="{{ account.stream }}" data-username="{{ account.username }}">
|
|
|
|
- Delete
|
|
|
|
- </button>
|
|
|
|
|
|
+ <form action="/accounts/delete" method="POST" style="display:inline;">
|
|
|
|
+ <input type="hidden" name="stream" value="{{ account.stream }}">
|
|
|
|
+ <input type="hidden" name="username" value="{{ account.username }}">
|
|
|
|
+ <button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this account?');">
|
|
|
|
+ Delete
|
|
|
|
+ </button>
|
|
|
|
+ </form>
|
|
</td>
|
|
</td>
|
|
</tr>
|
|
</tr>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
@@ -78,7 +89,6 @@
|
|
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
|
|
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
|
|
<script src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js"></script>
|
|
<script src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js"></script>
|
|
<script>
|
|
<script>
|
|
- const authValue = "{{ auth | safe }}"; // Passing `auth` safely
|
|
|
|
$(document).ready(function() {
|
|
$(document).ready(function() {
|
|
$.fn.dataTable.ext.type.order['date-eu'] = function(data) {
|
|
$.fn.dataTable.ext.type.order['date-eu'] = function(data) {
|
|
const parts = data.split('/');
|
|
const parts = data.split('/');
|
|
@@ -93,49 +103,6 @@
|
|
{ "type": "date-eu", "targets": 4 }
|
|
{ "type": "date-eu", "targets": 4 }
|
|
]
|
|
]
|
|
});
|
|
});
|
|
-
|
|
|
|
- $('#accountsTable tbody').on('click', '.password-cell', function() {
|
|
|
|
- const $cell = $(this);
|
|
|
|
- $cell.text($cell.data('password'));
|
|
|
|
- $cell.removeClass('password-blur');
|
|
|
|
-
|
|
|
|
- $(document).on('click.password', function(event) {
|
|
|
|
- if (!$(event.target).closest('.password-cell').length) {
|
|
|
|
- $cell.text('********').addClass('password-blur');
|
|
|
|
- $(document).off('click.password');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // Delete functionality
|
|
|
|
- $('.delete-account-btn').click(async function() {
|
|
|
|
- const stream = $(this).data('stream');
|
|
|
|
- const username = $(this).data('username');
|
|
|
|
-
|
|
|
|
- if (confirm(`Are you sure you want to delete account for stream: ${stream}, username: ${username}?`)) {
|
|
|
|
- try {
|
|
|
|
- const response = await fetch('http://vps.k-world.me.uk:3001/deleteAccount', {
|
|
|
|
- method: 'POST',
|
|
|
|
- headers: {
|
|
|
|
- 'Content-Type': 'application/json',
|
|
|
|
- 'Authorization': 'Basic ' + authValue // Adjust auth here as needed
|
|
|
|
- },
|
|
|
|
- body: JSON.stringify({ stream, username })
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- const result = await response.json();
|
|
|
|
- if (response.ok) {
|
|
|
|
- alert(result.message);
|
|
|
|
- $(this).closest('tr').remove();
|
|
|
|
- } else {
|
|
|
|
- alert(result.error || 'Failed to delete account');
|
|
|
|
- }
|
|
|
|
- } catch (error) {
|
|
|
|
- console.error('Error deleting account:', error);
|
|
|
|
- alert('Error occurred while deleting account');
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
</body>
|
|
</body>
|