New theme is setting

Co-authored-by: Zeynep <zeynepkotan50@gmail.com>
This commit is contained in:
Akif9748 2022-08-26 19:39:25 +03:00
parent ac19a6c69d
commit 527202037c
8 changed files with 45 additions and 79 deletions

View file

@ -90,12 +90,12 @@ And, you can learn about API in `util/APIDOCS.md`.
### New Theme ### New Theme
- [x] Users - [x] Users
- [x] Threads - [x] Threads
- [ ] Login - [x] Login
- [ ] Register - [x] Register
- [ ] Thread - [ ] Thread
- [ ] User - [ ] User
- [ ] Main page - [x] Main page
- [ ] Error - [x] Error
- [ ] ADMIN - [ ] ADMIN
- [ ] Create Thread - [ ] Create Thread

View file

@ -16,8 +16,8 @@ app.use(express.static("public"));
app.set("view engine", "ejs"); app.set("view engine", "ejs");
app.use(express.json()); app.use(express.json());
app.use(async (req, res, next) => { app.use(async (req, res, next) => {
res.error = (type, error) => res.status(type).render("error", { type, error });
req.user = await UserModel.get(req.session.userid); req.user = await UserModel.get(req.session.userid);
res.error = (type, error) => res.status(type).render("error", {user: req.user, type, error });
if (req.user?.deleted) { if (req.user?.deleted) {
req.session.destroy(); req.session.destroy();
return res.error(403, "Your account has been deleted."); return res.error(403, "Your account has been deleted.");

View file

@ -3,7 +3,7 @@ const { Router } = require("express");
const app = Router(); const app = Router();
const bcrypt = require("bcrypt"); const bcrypt = require("bcrypt");
app.get("/", (req, res) => res.render("login",{redirect: req.query.redirect})); app.get("/", (req, res) => res.render("login",{redirect: req.query.redirect,user:null}));
app.post("/", async (req, res) => { app.post("/", async (req, res) => {
req.session.userid = null; req.session.userid = null;

View file

@ -5,7 +5,7 @@ const rateLimit = require('express-rate-limit')
const app = Router(); const app = Router();
app.get("/", (req, res) => res.render("register")); app.get("/", (req, res) => res.render("register",{user:null}));
app.post("/", rateLimit({ app.post("/", rateLimit({
windowMs: 24*60*60_000, max: 1, standardHeaders: true, legacyHeaders: false, windowMs: 24*60*60_000, max: 1, standardHeaders: true, legacyHeaders: false,

View file

@ -1,37 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <%- include("extra/meta", {title: "User list!" }) %>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%= type %></title>
<meta name="description" content="Akf-forum has not got this page!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head>
<body > <body style="text-align: center;">
<%- include("extra/navbar") %>
<!-- Navbar: --> <h1 style="color: #4d18e6;"><%= type %></h1>
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a><br> <h2 style="color: #606060;"><%= error %></h2>
<a href="/"> <button class="big">MAIN PAGE</button> </a>
<hr>
<!-- Navbar end -->
<h1><%= type %></h1>
<h2><%= error %></h2>
<%- include("extra/old_footer") %>
</body> </body>
</html> </html>

View file

@ -1,27 +1,29 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<%- include("extra/old_header", {title: "Main page!" }) %> <%- include("extra/meta", {title: "User list!" }) %>
<body>
<%- include("extra/old_navbar") %>
<body style="text-align: center;">
<%- include("extra/navbar") %>
<% if (user) { %> <% if (user) { %>
<h1>Welcome, <a href=<%=user.getLink() %>> <%= user.name %></a> <h1 style="color: #4d18e6;">Welcome, <div class="box-username"><%= user.name %>
<img class="circle" src=<%=user.avatar %> alt=<%= user.name %>> <div class="avatar"><img src="<%=user.avatar %>"></div>
</div>
<br> <br>
You can log out of the site here: You can log out of the site here:
<a href="/login/"><button>LOGOUT</button> </a> <a href="/login" class="btn-outline-primary">LOGOUT</a>
</h1> </h1>
<br> <br>
<% } else { %> <% } else { %>
<h1>Welcome, Guest!<br>You can press the button to register: <h1 style="color: #4d18e6;">Welcome, Guest!<br>You can press the button to register:
<a href="/register/"> <button class="big">REGISTER</button> </a> <a href="/register" class="btn-outline-primary">REGISTER</a>
</h1> </h1>
<% } %> <% } %>
<h1>Statistics:</h1> <h1 style="color: #606060;">Statistics:</h1>
<ul> <ul>
<li> <li>
<h3>Message count: <b> <h3>Message count: <b>
@ -45,9 +47,7 @@
</li> </li>
</ul> </ul>
<%- include("extra/old_footer") %>
</body> </body>
</html> </html>

View file

@ -1,26 +1,23 @@
</html>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<%- include("extra/old_header", {title: "Login page!" }) %> <%- include("extra/meta", {title: "Log in!" }) %>
<body>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br>
<a href="/register/"> <button class="big">REGISTER</button> </a>
<hr>
<body style="text-align: center;">
<%- include("extra/navbar") %>
<h1 style="color: #4d18e6;">Login</h1>
<h1>Login</h1>
<hr>
<form action="/login?redirect=<%= redirect %>" method="post"> <form action="/login?redirect=<%= redirect %>" method="post">
<input type="text" name="username" placeholder="Username" id="username" required> <input type="text" name="username" placeholder="Username" id="username" required>
<input type="password" name="password" placeholder="Password" id="password" required> <input type="password" name="password" placeholder="Password" id="password" required>
<input type="submit" value="Login"> <input type="submit" value="Login">
</form> </form>
<%- include("extra/old_footer") %>
</body> </body>
</html> </html>

View file

@ -1,23 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<%- include("extra/meta", {title: "Register!" }) %>
<%- include("extra/old_header", {title: "Register!" }) %>
<body>
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <body style="text-align: center;">
<br> <%- include("extra/navbar") %>
<a href="/login/"> <button class="big">LOGIN</button> </a> <h1 style="color: #4d18e6;">Register</h1>
<hr>
<h1>Register</h1>
<hr>
<form action="/register" method="post"> <form action="/register" method="post">
@ -30,7 +21,7 @@
<input type="submit" value="Register"> <input type="submit" value="Register">
</form> </form>
<%- include("extra/old_footer") %>
</body> </body>
</html> </html>