91 lines
3.8 KiB
HTML
91 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Установка</title>
|
||
<link rel="stylesheet" href="../styles/main.css" />
|
||
</head>
|
||
<body>
|
||
|
||
<section class="form left">
|
||
<form enctype="multipart/form-data" method="post" action="/setup" id="setupForm">
|
||
<h1>Добро пожаловать в Аргус</h1>
|
||
<h2>Приступим к созданию организации</h2>
|
||
|
||
<label for="name">Название<span>*</span></label>
|
||
<input title="Название вашей организации" placeholder="Название вашей организации" name="name" type="text" required>
|
||
|
||
<label for="login">Логин администратора<span>*</span></label>
|
||
<input title="Логин для панели управления" placeholder="Логин для панели управления" name="login" type="text" required>
|
||
|
||
<label for="password">Пароль администратора<span>*</span></label>
|
||
<input title="Пароль для панели управления" placeholder="Пароль для панели управления" name="password" type="password" required>
|
||
|
||
<label for="repassword">Подтверждение<span>*</span></label>
|
||
<input title="Повторите пароль" placeholder="Повторите пароль" name="repassword" type="password" required>
|
||
|
||
<button type="submit">Установить</button>
|
||
</form>
|
||
</section>
|
||
|
||
|
||
<video class="animation right" autoplay muted loop>
|
||
<source src="../img/traffic.mp4" type="video/mp4">
|
||
</video>
|
||
<span class="copyright right"><a href="https://dribbble.com/shots/15608015-Traffic">Видеоматериал создан Igor Kozak для 10Clouds</a></span>
|
||
|
||
<script>
|
||
document.addEventListener("DOMContentLoaded", function() {
|
||
const passwordInput = document.querySelector('input[name="password"]');
|
||
const repasswordInput = document.querySelector('input[name="repassword"]');
|
||
|
||
// Обработка отправки формы в формате JSON
|
||
const setupForm = document.getElementById('setupForm');
|
||
setupForm.addEventListener('submit', function(event) {
|
||
const password = passwordInput.value;
|
||
const repassword = repasswordInput.value;
|
||
|
||
if (password !== repassword) {
|
||
alert('Пароли не совпадают');
|
||
event.preventDefault();
|
||
return;
|
||
}
|
||
|
||
event.preventDefault();
|
||
const formData = new FormData(setupForm);
|
||
const jsonData = {};
|
||
|
||
formData.forEach((value, key) => {
|
||
jsonData[key] = value;
|
||
});
|
||
|
||
const xhr = new XMLHttpRequest();
|
||
xhr.open('POST', '/setup');
|
||
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
|
||
|
||
xhr.onload = function() {
|
||
if (xhr.status === 200) {
|
||
location.href = '/';
|
||
} else {
|
||
alert('Произошла ошибка при отправке данных');
|
||
window.location.reload();
|
||
}
|
||
};
|
||
|
||
xhr.onerror = function() {
|
||
// Ошибка сети
|
||
alert('Произошла ошибка сети');
|
||
};
|
||
|
||
xhr.send(JSON.stringify(jsonData));
|
||
});
|
||
});
|
||
</script>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html> |