ArgusSite/static/templates/register.html

103 lines
4.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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" id="copyright"><a href="https://dribbble.com/shots/15608015-Traffic" target="_blank">Видеоматериал создан Igor Kozak для 10Clouds</a></span>
<span id="info-icon" class="right"><a href="https://dribbble.com/shots/15608015-Traffic" target="_blank">i</a></span>
<script>
document.getElementById('info-icon').addEventListener('mouseenter', function () {
document.getElementById('copyright').style.opacity = '1';
});
document.getElementById('info-icon').addEventListener('mouseleave', function () {
document.getElementById('copyright').style.opacity = '0';
});
</script>
<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>