Initial commit
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>TNProxy - Смена пароля</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; padding: 20px; }
|
||||
.container { max-width: 500px; margin: 0 auto; }
|
||||
h1 { color: #333; margin-bottom: 20px; }
|
||||
.btn { display: inline-block; padding: 10px 20px; background: #0088cc; color: white; text-decoration: none; border-radius: 5px; border: none; cursor: pointer; font-size: 14px; }
|
||||
.btn:hover { background: #006699; }
|
||||
.btn-secondary { background: #666; }
|
||||
.nav { margin-bottom: 20px; }
|
||||
.nav a { margin-right: 15px; color: #0088cc; text-decoration: none; }
|
||||
.card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 20px; }
|
||||
.form-group { margin-bottom: 15px; }
|
||||
label { display: block; margin-bottom: 5px; font-weight: 500; }
|
||||
input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 14px; }
|
||||
.success { color: #28a745; margin-bottom: 15px; }
|
||||
.error { color: #dc3545; margin-bottom: 15px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>TNProxy</h1>
|
||||
|
||||
<div class="nav">
|
||||
<a href="/adtn">Приложения</a>
|
||||
<a href="/adtn/logs">Логи</a>
|
||||
<a href="/adtn/api">API Docs</a>
|
||||
<a href="/adtn/password">Пароль</a>
|
||||
<a href="#" id="logout">Выход</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Смена пароля</h2>
|
||||
<div id="message"></div>
|
||||
<form id="passwordForm">
|
||||
<div class="form-group">
|
||||
<label>Текущий пароль</label>
|
||||
<input type="password" name="old_password" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Новый пароль</label>
|
||||
<input type="password" name="new_password" required minlength="6">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Подтверждение пароля</label>
|
||||
<input type="password" name="confirm_password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn">Изменить пароль</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('logout').onclick = async (e) => {
|
||||
e.preventDefault();
|
||||
await fetch('/logout', { method: 'POST' });
|
||||
window.location.href = '/login';
|
||||
};
|
||||
|
||||
document.getElementById('passwordForm').onsubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(e.target);
|
||||
|
||||
if (formData.get('new_password') !== formData.get('confirm_password')) {
|
||||
document.getElementById('message').innerHTML = '<div class="error">Пароли не совпадают</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
const data = {
|
||||
old_password: formData.get('old_password'),
|
||||
new_password: formData.get('new_password')
|
||||
};
|
||||
|
||||
const res = await fetch('/adtn/password', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
const result = await res.json();
|
||||
|
||||
if (result.success) {
|
||||
document.getElementById('message').innerHTML = '<div class="success">Пароль изменен!</div>';
|
||||
e.target.reset();
|
||||
} else {
|
||||
document.getElementById('message').innerHTML = '<div class="error">' + result.error + '</div>';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user