2024-01-15 18:51:51 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Login</title>
|
|
|
|
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
|
|
|
<script src="//code.jquery.com/jquery-2.2.4.min.js"></script>
|
|
|
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
2024-01-17 18:33:59 +03:00
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
background-color: black;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
label {
|
|
|
|
font-size: 20px;
|
|
|
|
}
|
|
|
|
input {
|
|
|
|
background-color: #282828;
|
|
|
|
border: none;
|
|
|
|
border-bottom: 1px solid white;
|
|
|
|
color: white;
|
|
|
|
font-size: 18px;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
button {
|
|
|
|
background-color: #4CAF50;
|
|
|
|
border: none;
|
|
|
|
color: white;
|
|
|
|
font-size: 22px;
|
|
|
|
padding: 10px 20px;
|
|
|
|
margin-top: 20px;
|
|
|
|
}
|
|
|
|
button:hover {
|
|
|
|
background-color: #3e8e41;
|
|
|
|
}
|
|
|
|
</style>
|
2024-01-15 18:51:51 +03:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2024-01-17 18:33:59 +03:00
|
|
|
<div class="container">
|
|
|
|
<h1>Login</h1>
|
|
|
|
<form>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="user_login">Username</label>
|
|
|
|
<input type="text" class="form-control" name="user_login" required placeholder="Enter your username">
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="client_secret">Password</label>
|
|
|
|
<input type="password" class="form-control" name="client_secret" placeholder="Enter your password">
|
|
|
|
</div>
|
|
|
|
<button id="login-btn">Login</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
const loginBtn = document.getElementById('login-btn');
|
|
|
|
loginBtn.addEventListener('click', (event) => {
|
|
|
|
event.preventDefault();
|
|
|
|
const userLogin = document.querySelector('input[name="user_login"]').value;
|
|
|
|
const clientSecret = document.querySelector('input[name="client_secret"]').value;
|
|
|
|
const backRedirectionAddress = new URLSearchParams(window.location.search).get('back_redirection_address');
|
|
|
|
fetch('http://auth-server/login?user_login=${userLogin}&client_secret=${clientSecret}')
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
const accessToken = data.access_token;
|
|
|
|
window.location.href = '${backRedirectionAddress}?access_token=${accessToken}&user_login=${userLogin}';
|
|
|
|
})
|
|
|
|
.catch(error => console.error(error));
|
|
|
|
});
|
|
|
|
</script>
|
2024-01-15 18:51:51 +03:00
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|