fix frontend

This commit is contained in:
echpochmak31 2024-01-17 20:24:14 +03:00
parent 79a00f0866
commit 0638ed6601

View file

@ -12,9 +12,11 @@
background-color: black; background-color: black;
color: white; color: white;
} }
label { label {
font-size: 20px; font-size: 20px;
} }
input { input {
background-color: #282828; background-color: #282828;
border: none; border: none;
@ -24,6 +26,7 @@
margin-bottom: 20px; margin-bottom: 20px;
padding: 10px; padding: 10px;
} }
button { button {
background-color: #4CAF50; background-color: #4CAF50;
border: none; border: none;
@ -32,6 +35,7 @@
padding: 10px 20px; padding: 10px 20px;
margin-top: 20px; margin-top: 20px;
} }
button:hover { button:hover {
background-color: #3e8e41; background-color: #3e8e41;
} }
@ -60,11 +64,11 @@
const userLogin = document.querySelector('input[name="user_login"]').value; const userLogin = document.querySelector('input[name="user_login"]').value;
const clientSecret = document.querySelector('input[name="client_secret"]').value; const clientSecret = document.querySelector('input[name="client_secret"]').value;
const backRedirectionAddress = new URLSearchParams(window.location.search).get('back_redirection_address'); const backRedirectionAddress = new URLSearchParams(window.location.search).get('back_redirection_address');
fetch(`http://auth-server/login?user_login=${userLogin}&client_secret=${clientSecret}`) fetch(`http://localhost:9096/login?client_id=${userLogin}&client_secret=${clientSecret}&scope=all&grant_type=client_credentials`)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
const accessToken = data.access_token;
window.location.href = `${backRedirectionAddress}?access_token=${accessToken}&user_login=${userLogin}`; window.location.href = `https://${backRedirectionAddress}?access_token=${accessToken}&user_login=${userLogin}`;
}) })
.catch(error => console.error(error)); .catch(error => console.error(error));
}); });