admin_users.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!DOCTYPE html>
  2. <html lang="el">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Users - WiSearch Panel</title>
  7. <style>
  8. body { background-color: #121212; color: #e0e0e0; font-family: 'Segoe UI', Tahoma, sans-serif; margin: 0; padding: 20px; }
  9. /* Κοινό Header με το Admin Dashboard */
  10. .header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #333; padding-bottom: 15px; margin-bottom: 20px; }
  11. .title { color: #bb86fc; margin: 0; }
  12. .title span { color: #e0e0e0; }
  13. .nav-links a { color: #03dac6; text-decoration: none; margin-left: 15px; font-weight: bold; }
  14. .nav-links a:hover { text-decoration: underline; }
  15. /* Κεντρικά Κουτιά */
  16. .content-box { background: #1e1e1e; padding: 20px; border-radius: 8px; border: 1px solid #333; max-width: 1000px; margin: 0 auto 20px auto; }
  17. h3 { color: #bb86fc; border-bottom: 1px solid #333; padding-bottom: 10px; margin-top: 0; }
  18. /* Φόρμες & Κουμπιά */
  19. input, select { background: #121212; border: 1px solid #333; color: #e0e0e0; padding: 10px; border-radius: 4px; font-family: monospace; box-sizing: border-box; }
  20. input:focus, select:focus { border-color: #bb86fc; outline: none; }
  21. .btn { padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; color: #000; background: #03dac6; transition: 0.2s; }
  22. .btn:hover { opacity: 0.8; }
  23. .btn-danger { background: #cf6679; color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 4px; font-size: 12px; transition: 0.2s; }
  24. .btn-danger:hover { background: #ff4d4d; }
  25. /* Στυλ Πίνακα */
  26. table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
  27. th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #333; }
  28. th { background-color: #2d2d2d; color: #03dac6; }
  29. /* Ταμπελάκια Ρόλων (Pills) */
  30. .role-pill { font-size: 11px; padding: 4px 10px; border-radius: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; }
  31. .role-admin { background: rgba(187, 134, 252, 0.1); color: #bb86fc; border: 1px solid rgba(187, 134, 252, 0.3); }
  32. .role-user { background: rgba(3, 218, 198, 0.1); color: #03dac6; border: 1px solid rgba(3, 218, 198, 0.3); }
  33. /* Μηνύματα Συστήματος */
  34. .flash { background: #03dac6; color: #000; font-weight: bold; padding: 10px; border-radius: 4px; margin-bottom: 20px; max-width: 1000px; margin-left: auto; margin-right: auto; }
  35. .footer { margin-top: 40px; text-align: center; font-size: 12px; color: #9e9e9e; }
  36. .footer b { color: #e0e0e0; }
  37. </style>
  38. </head>
  39. <body>
  40. <div class="header">
  41. <h1 class="title">WiSearch <span>Panel</span></h1>
  42. <div class="nav-links">
  43. <a href="/">🏠 Αναζήτηση</a>
  44. <a href="/admin">⚙️ Πίνακας Ελέγχου</a>
  45. <a href="/admin/logs">📜 Logs</a>
  46. <a href="/logout" style="color: #cf6679;">🚪 Έξοδος ({{ session['username'] }})</a>
  47. </div>
  48. </div>
  49. {% with messages = get_flashed_messages() %}
  50. {% if messages %}
  51. {% for msg in messages %}
  52. <div class="flash">{{ msg }}</div>
  53. {% endfor %}
  54. {% endif %}
  55. {% endwith %}
  56. <div class="content-box">
  57. <h3>➕ Προσθήκη Νέου Χρήστη</h3>
  58. <form action="/admin/users/add" method="POST" style="display: flex; gap: 10px; align-items: center; flex-wrap: wrap;">
  59. <input type="text" name="username" placeholder="Username" required style="flex: 1; min-width: 200px;">
  60. <input type="password" name="password" placeholder="Password" required style="flex: 1; min-width: 200px;">
  61. <select name="role" required style="flex: 1; min-width: 200px;">
  62. <option value="user">User (Μόνο Sponsored Links)</option>
  63. <option value="admin">Admin (Πλήρης Πρόσβαση)</option>
  64. </select>
  65. <button type="submit" class="btn" style="background: #bb86fc;">Δημιουργία</button>
  66. </form>
  67. </div>
  68. <div class="content-box">
  69. <h3>👥 Λίστα Χρηστών</h3>
  70. <table>
  71. <tr>
  72. <th>Username</th>
  73. <th>Ρόλος</th>
  74. <th>Αλλαγή Password</th>
  75. <th>Ενέργειες</th>
  76. </tr>
  77. {% for u in users %}
  78. <tr>
  79. <td style="font-size: 16px; color: #e0e0e0; font-weight: bold;">{{ u.username }}</td>
  80. <td><span class="role-pill {% if u.role == 'admin' %}role-admin{% else %}role-user{% endif %}">{{ u.role }}</span></td>
  81. <td>
  82. <form action="/admin/users/reset/{{ u.id }}" method="POST" style="display: flex; gap: 5px; margin: 0;">
  83. <input type="text" name="new_password" placeholder="Νέος κωδικός" required style="margin: 0; padding: 6px; font-size: 12px; width: 140px;">
  84. <button type="submit" class="btn" style="padding: 6px 12px; font-size: 12px;">Αλλαγή</button>
  85. </form>
  86. </td>
  87. <td>
  88. {% if u.username != session['username'] %}
  89. <a href="/admin/users/delete/{{ u.id }}" class="btn-danger" onclick="return confirm('Οριστική διαγραφή χρήστη {{ u.username }};')">Διαγραφή</a>
  90. {% else %}
  91. <span style="color: #5f6368; font-size: 12px; font-style: italic;">(Τρέχων χρήστης)</span>
  92. {% endif %}
  93. </td>
  94. </tr>
  95. {% endfor %}
  96. </table>
  97. </div>
  98. <div class="footer">
  99. ⚡ Powered by <b>#6610 Maiden</b>
  100. </div>
  101. </body>
  102. </html>