initial import
This commit is contained in:
127
templates/settings.html
Normal file
127
templates/settings.html
Normal file
@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Einstellungen</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
text-align: center;
|
||||
background-color: #f0f0f0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-top: 50px;
|
||||
}
|
||||
.container {
|
||||
margin: 20px auto;
|
||||
max-width: 600px;
|
||||
padding: 20px;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.button {
|
||||
display: inline-block;
|
||||
padding: 15px 25px;
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
background-color: #007bff;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
text-decoration: none;
|
||||
margin: 10px;
|
||||
}
|
||||
.button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
.form-group {
|
||||
margin: 15px 0;
|
||||
}
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.form-group button {
|
||||
padding: 10px 15px;
|
||||
font-size: 16px;
|
||||
color: white;
|
||||
background-color: #28a745;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.form-group button:hover {
|
||||
background-color: #218838;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Einstellungen</h1>
|
||||
<div class="container">
|
||||
<!-- Formular zum Ändern des Benutzernamens -->
|
||||
<form id="username-form">
|
||||
<div class="form-group">
|
||||
<label for="new-username">Neuer Benutzername:</label>
|
||||
<input type="text" id="new-username" name="new-username" placeholder="Neuer Benutzername" required>
|
||||
</div>
|
||||
<button type="submit">Benutzernamen ändern</button>
|
||||
<div id="username-error" class="error"></div>
|
||||
</form>
|
||||
|
||||
<!-- Formular zum Abmelden -->
|
||||
<form id="logout-form" action="/logout" method="POST" style="display: inline;">
|
||||
<button type="submit" class="button">Abmelden</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('username-form').addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
const newUsername = document.getElementById('new-username').value;
|
||||
|
||||
fetch('/change_username', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
new_username: newUsername
|
||||
})
|
||||
}).then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
document.getElementById('username-error').textContent = data.error;
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('Error changing username:', error);
|
||||
document.getElementById('username-error').textContent = 'Ein Fehler ist aufgetreten.';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user