modify html

This commit is contained in:
echpochmak31 2024-01-15 20:58:19 +03:00
parent 9e02980415
commit 850d0af0bb

View file

@ -12,7 +12,7 @@
<body>
<div class="container">
<h1>Sign In</h1>
<form id="loginForm" action="/login" method="GET">
<form action="/login" method="GET">
<input type="hidden" name="grant_type" value="client_credentials" />
<input type="hidden" name="scope" value="all" />
<div class="form-group">
@ -25,29 +25,10 @@
</div>
<button type="submit" class="btn btn-success">Sign In</button>
</form>
<form id="registerForm" action="/register.html" method="GET">
<form action="/register.html" method="GET">
<button type="submit" class="btn btn-primary">Register</button>
</form>
</div>
<script>
function submitFormWithReferer(formId) {
var form = document.getElementById(formId);
var referrer = document.referrer || "";
form.insertAdjacentHTML('beforeend', '<input type="hidden" name="referer" value="' + referrer + '">');
form.submit();
}
document.getElementById("loginForm").addEventListener("submit", function (event) {
event.preventDefault();
submitFormWithReferer("loginForm");
});
document.getElementById("registerForm").addEventListener("submit", function (event) {
event.preventDefault();
submitFormWithReferer("registerForm");
});
</script>
</body>
</html>