mirror of
https://github.com/arthur-pbty/LazyBot.git
synced 2026-06-10 17:24:10 +02:00
Init Discord OAuth2
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Connexion Discord</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Bienvenue !</h1>
|
||||
<a href="/auth/discord">
|
||||
<button>Se connecter avec Discord</button>
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bienvenue</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="greeting">Chargement...</h1>
|
||||
<img id="avatar" src="" alt="Avatar">
|
||||
|
||||
<script>
|
||||
// Récupérer l'objet user depuis le serveur
|
||||
fetch("/api/user")
|
||||
.then(res => res.json())
|
||||
.then(user => {
|
||||
document.getElementById("greeting").textContent = `Salut ${user.username}#${user.discriminator} !`;
|
||||
document.getElementById("avatar").src = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png`;
|
||||
})
|
||||
.catch(() => {
|
||||
document.getElementById("greeting").textContent = "Utilisateur non connecté.";
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user