aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2024-12-24 15:05:33 -0500
committerAndrew Lee <andrew@alee14.me>2024-12-24 15:05:33 -0500
commit70f071180c932e9cf5029b47ec5e0d1e2623b4b4 (patch)
tree86321d630681c3af46b453f820789da87ff6f111
parent4811a3eabc1e7afaf17b45f9dea541d987c45717 (diff)
downloadfreeso-discord-auth-70f071180c932e9cf5029b47ec5e0d1e2623b4b4.tar.gz
freeso-discord-auth-70f071180c932e9cf5029b47ec5e0d1e2623b4b4.tar.bz2
freeso-discord-auth-70f071180c932e9cf5029b47ec5e0d1e2623b4b4.zip
Dashboard, fixed some issues with port
-rw-r--r--README.md2
-rw-r--r--index.js8
-rw-r--r--public/css/style.css36
-rw-r--r--views/dashboard.ejs20
-rw-r--r--views/index.ejs5
-rw-r--r--views/password.ejs (renamed from views/login.ejs)2
-rw-r--r--views/register.ejs1
-rw-r--r--views/success.ejs2
8 files changed, 64 insertions, 12 deletions
diff --git a/README.md b/README.md
index 386f684..a092fcf 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# bnbso-auth
-Web authentication for bnbSO (registering accounts, resetting passwords, changing passwords) using Discord authentication. Programmed for FreeSO-based servers.
+Web authentication for bnbSO (registering accounts, resetting passwords, changing passwords) using Discord authentication. Designed for FreeSO-based servers.
To install dependencies:
diff --git a/index.js b/index.js
index c109ab2..f82209b 100644
--- a/index.js
+++ b/index.js
@@ -62,13 +62,13 @@ app.use(passport.session());
// Routes
app.get("/", async (req, res) => {
if (req.isAuthenticated()) {
- const { id, username, email, guilds } = req.user;
+ const { id, guilds } = req.user;
const isInGuild = guilds.some((guild) => guild.id === process.env.GUILD_ID);
if (isInGuild) {
- let userExists = true;
+ let userExists = false;
if (userExists) {
- return res.render('login');
+ return res.render('dashboard', req.user);
} else {
return res.render('register', req.user);
}
@@ -137,4 +137,4 @@ app.get("/logout", (req, res) => {
});
const port = 3000;
-app.listen(PORT, () => console.log(`Server running on http://localhost:${port}`));
+app.listen(port, () => console.log(`Server running on http://localhost:${port}`));
diff --git a/public/css/style.css b/public/css/style.css
index 31d3530..a6c3ea8 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -30,11 +30,11 @@ a:active {
color: #2773ff;
}
-.discord {
+.button {
display: inline-block;
text-decoration: none;
color: #fff;
- background-color: #5865F2;
+ background-color: #00633a;
padding: 10px 20px;
border-radius: 5px;
transition: 0.2s;
@@ -42,6 +42,36 @@ a:active {
}
+.button:hover {
+ background-color: #009959;
+ color: #fff;
+}
+
+.button:active {
+ background-color: #003620;
+ color: #fff;
+}
+
+.logout {
+ background-color: #630000;
+
+}
+
+.logout:hover {
+ background-color: #990000;
+}
+
+.logout:active {
+ background-color: #360000;
+}
+
+
+
+.discord {
+ background-color: #5865F2;
+
+}
+
.discord:hover {
background-color: #727dee;
}
@@ -107,6 +137,6 @@ button {
}
.error {
- color: rgb(248, 140, 140);
+ color: #f88c8c;
font-size: 1.5em;
} \ No newline at end of file
diff --git a/views/dashboard.ejs b/views/dashboard.ejs
new file mode 100644
index 0000000..b50f0e0
--- /dev/null
+++ b/views/dashboard.ejs
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link rel="stylesheet" href="/css/style.css">
+ <title>bnbSO Dashboard</title>
+</head>
+<body>
+ <div class="background"></div>
+ <div class="container">
+ <img src="img/logo.png" alt="logo" width="200">
+ <p>Welcome, <%= username %>!</p>
+ <p>FreeSO Username:</p>
+ <a href="#" class="button">Change Password</a>
+ <a href="#" class="button">Download bnbSO Client</a>
+ <a href="/logout" class="button logout">Logout</a>
+ </div>
+</body>
+</html> \ No newline at end of file
diff --git a/views/index.ejs b/views/index.ejs
index d46a61a..dc893d4 100644
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -10,8 +10,9 @@
<div class="background"></div>
<div class="container">
<img src="img/logo.png" alt="logo" width="200">
- <p>You must be a member of the bits & Bytes Discord server to join bnbSO.</p>
- <a class="discord" href="/auth/discord">Login with Discord</a>
+ <p>Log into your Discord account to get access to bnbSO.</p>
+ <p><i>You must be a bits & Bytes member to join.</i></p>
+ <a class="button discord" href="/auth/discord">Login with Discord</a>
</div>
</body>
</html> \ No newline at end of file
diff --git a/views/login.ejs b/views/password.ejs
index a5a51ae..2e24399 100644
--- a/views/login.ejs
+++ b/views/password.ejs
@@ -14,7 +14,7 @@
<form method="post" action="/login">
<label for="username">Username:</label>
<input type="text" id="username" name="username">
- <label for="password">Password:</label>
+ <label for="password">Current Password:</label>
<input type="password" id="password" name="password">
<button type="submit">Login</button>
</form>
diff --git a/views/register.ejs b/views/register.ejs
index fcff088..66058c3 100644
--- a/views/register.ejs
+++ b/views/register.ejs
@@ -13,6 +13,7 @@
<h1>Welcome to bnbSO!</h1>
<p>You will be sending the following information to register your bnbSO account</p>
<p>Please verify that the following information is correct. You can only change this <b>once</b>.</p>
+ <p>Note: You can change your username and email if you want to change it.<br>It is there as your Discord account are using these credentials.</p>
<form method="post" action="/register">
<label for="username">Username:</label>
<input type="text" id="username" name="username" value="<%= username %>">
diff --git a/views/success.ejs b/views/success.ejs
index c967d24..224b260 100644
--- a/views/success.ejs
+++ b/views/success.ejs
@@ -12,7 +12,7 @@
<img src="img/logo.png" alt="logo" width="200">
<p>Created account successfully!</p>
<p>Check on your inbox for the confirmation code.</p>
- <a href="/">Home</a>
+ <a href="/">Dashboard</a>
</div>
</body>
</html> \ No newline at end of file