-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.html
162 lines (142 loc) · 5.15 KB
/
admin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin-Seite</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #e0f7fa;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background-color: #ffffff;
padding: 30px;
border-radius: 15px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 500px;
max-width: 90%;
}
.container h2 {
margin-bottom: 20px;
font-size: 28px;
text-align: center;
color: #333;
}
.user-list {
list-style-type: none;
padding: 0;
margin: 0;
}
.user-list li {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #ccc;
}
.actions {
display: flex;
gap: 10px;
}
.edit-btn,
.change-password-btn,
.delete-btn {
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
padding: 10px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s ease;
}
.delete-btn {
background-color: #FF5722;
}
.edit-btn:hover,
.change-password-btn:hover,
.delete-btn:hover {
background-color: #0056b3;
}
.delete-btn:hover {
background-color: #e64a19;
}
.privacy-status {
font-weight: bold;
}
.privacy-status.accepted {
color: #28a745;
}
.privacy-status.not-accepted {
color: #dc3545;
}
.username {
color: #00695c;
}
</style>
</head>
<body>
<div class="container">
<h2>Admin-Seite</h2>
<ul class="user-list" id="userList"></ul>
</div>
<script>
function loadUsers() {
const users = JSON.parse(localStorage.getItem('users')) || {};
const userList = document.getElementById('userList');
userList.innerHTML = '';
Object.keys(users).forEach(username => {
const user = users[username];
const acceptedPrivacy = user.acceptedPrivacy;
const acceptedTerms = user.acceptedTerms;
const li = document.createElement('li');
li.innerHTML = `
<span class="username">${username} - Datenschutzerklärung: <span class="privacy-status ${acceptedPrivacy ? 'accepted' : 'not-accepted'}">${acceptedPrivacy ? 'Akzeptiert' : 'Nicht akzeptiert'}</span> - AGB: <span class="privacy-status ${acceptedTerms ? 'accepted' : 'not-accepted'}">${acceptedTerms ? 'Akzeptiert' : 'Nicht akzeptiert'}</span></span>
<div class="actions">
<button class="edit-btn" onclick="editUser('${username}')">Bearbeiten</button>
<button class="change-password-btn" onclick="changePassword('${username}')">Passwort ändern</button>
<button class="delete-btn" onclick="deleteUser('${username}')">Löschen</button>
</div>
`;
userList.appendChild(li);
});
}
function deleteUser(username) {
const users = JSON.parse(localStorage.getItem('users')) || {};
delete users[username];
localStorage.setItem('users', JSON.stringify(users));
loadUsers();
}
function editUser(username) {
const newUsername = prompt('Neuen Benutzernamen eingeben:', username);
if (newUsername && newUsername !== username) {
const users = JSON.parse(localStorage.getItem('users')) || {};
if (users[newUsername]) {
alert('Benutzername existiert bereits. Bitte wählen Sie einen anderen.');
} else {
users[newUsername] = users[username];
delete users[username];
localStorage.setItem('users', JSON.stringify(users));
loadUsers();
}
}
}
function changePassword(username) {
const newPassword = prompt('Neues Passwort eingeben:');
if (newPassword) {
const users = JSON.parse(localStorage.getItem('users')) || {};
users[username].password = newPassword;
localStorage.setItem('users', JSON.stringify(users));
loadUsers();
}
}
document.addEventListener('DOMContentLoaded', loadUsers);
</script>
</body>
</html>