Test username retrieve

This commit is contained in:
Emilio Soriano Chávez 2024-11-20 18:59:58 -05:00
parent 76e6209f9a
commit 2fb3caf548
2 changed files with 21 additions and 1 deletions

19
assets/js/get_username.js Normal file
View File

@ -0,0 +1,19 @@
async function getData() {
const url = "https://login.ami.sc/";
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}
const user_name = response.headers.get("X-Authentik-Name");
console.log(user_name);
document.getElementById("username").innerHTML = user_name;
} catch (error) {
console.error(error.message);
}
}
getData();

View File

@ -15,7 +15,8 @@
</header>
<div class="link_box personal">
<h2>🤵🏼 Personal</h2>
<h2 id="username">Failed</h2>
<script src="assets/js/get_username.js"></script>
<a href="https://account.proton.me/login">
<img src="assets/img/proton.svg">
Proton