Compare commits
4 commits
e6bf86caa9
...
0638ed6601
Author | SHA1 | Date | |
---|---|---|---|
0638ed6601 | |||
79a00f0866 | |||
eafb53bc4a | |||
135df93d49 |
1 changed files with 55 additions and 11 deletions
|
@ -7,28 +7,72 @@
|
||||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
<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="//code.jquery.com/jquery-2.2.4.min.js"></script>
|
||||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||||
|
<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>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Sign In</h1>
|
<h1>Login</h1>
|
||||||
<form action="/login" method="GET">
|
<form>
|
||||||
<input type="hidden" name="grant_type" value="client_credentials" />
|
|
||||||
<input type="hidden" name="scope" value="all" />
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="client_id">User Name</label>
|
<label for="user_login">Username</label>
|
||||||
<input type="text" class="form-control" name="client_id" required placeholder="Please enter your user name">
|
<input type="text" class="form-control" name="user_login" required placeholder="Enter your username">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="client_secret">Password</label>
|
<label for="client_secret">Password</label>
|
||||||
<input type="password" class="form-control" name="client_secret" placeholder="Please enter your password">
|
<input type="password" class="form-control" name="client_secret" placeholder="Enter your password">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-success">Sign In</button>
|
<button id="login-btn">Login</button>
|
||||||
</form>
|
|
||||||
<form action="/register.html" method="GET">
|
|
||||||
<button type="submit" class="btn btn-primary">Register</button>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</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://localhost:9096/login?client_id=${userLogin}&client_secret=${clientSecret}&scope=all&grant_type=client_credentials`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
|
||||||
|
window.location.href = `https://${backRedirectionAddress}?access_token=${accessToken}&user_login=${userLogin}`;
|
||||||
|
})
|
||||||
|
.catch(error => console.error(error));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue