mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-22 20:10:40 +03:00
New theme is setting
Co-authored-by: Zeynep <zeynepkotan50@gmail.com>
This commit is contained in:
parent
ac19a6c69d
commit
527202037c
8 changed files with 45 additions and 79 deletions
|
@ -90,12 +90,12 @@ And, you can learn about API in `util/APIDOCS.md`.
|
|||
### New Theme
|
||||
- [x] Users
|
||||
- [x] Threads
|
||||
- [ ] Login
|
||||
- [ ] Register
|
||||
- [x] Login
|
||||
- [x] Register
|
||||
- [ ] Thread
|
||||
- [ ] User
|
||||
- [ ] Main page
|
||||
- [ ] Error
|
||||
- [x] Main page
|
||||
- [x] Error
|
||||
- [ ] ADMIN
|
||||
- [ ] Create Thread
|
||||
|
||||
|
|
2
index.js
2
index.js
|
@ -16,8 +16,8 @@ app.use(express.static("public"));
|
|||
app.set("view engine", "ejs");
|
||||
app.use(express.json());
|
||||
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);
|
||||
res.error = (type, error) => res.status(type).render("error", {user: req.user, type, error });
|
||||
if (req.user?.deleted) {
|
||||
req.session.destroy();
|
||||
return res.error(403, "Your account has been deleted.");
|
||||
|
|
|
@ -3,7 +3,7 @@ const { Router } = require("express");
|
|||
const app = Router();
|
||||
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) => {
|
||||
req.session.userid = null;
|
||||
|
|
|
@ -5,7 +5,7 @@ const rateLimit = require('express-rate-limit')
|
|||
|
||||
const app = Router();
|
||||
|
||||
app.get("/", (req, res) => res.render("register"));
|
||||
app.get("/", (req, res) => res.render("register",{user:null}));
|
||||
|
||||
app.post("/", rateLimit({
|
||||
windowMs: 24*60*60_000, max: 1, standardHeaders: true, legacyHeaders: false,
|
||||
|
|
|
@ -1,37 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<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>
|
||||
<%- include("extra/meta", {title: "User list!" }) %>
|
||||
|
||||
|
||||
<body >
|
||||
<body style="text-align: center;">
|
||||
<%- include("extra/navbar") %>
|
||||
|
||||
<!-- Navbar: -->
|
||||
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a><br>
|
||||
<h1 style="color: #4d18e6;"><%= type %></h1>
|
||||
<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>
|
||||
|
||||
</html>
|
|
@ -1,27 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<%- include("extra/old_header", {title: "Main page!" }) %>
|
||||
<body>
|
||||
<%- include("extra/meta", {title: "User list!" }) %>
|
||||
|
||||
<%- include("extra/old_navbar") %>
|
||||
|
||||
<% if (user) { %>
|
||||
<h1>Welcome, <a href=<%=user.getLink() %>> <%= user.name %></a>
|
||||
<img class="circle" src=<%=user.avatar %> alt=<%= user.name %>>
|
||||
<body style="text-align: center;">
|
||||
<%- include("extra/navbar") %>
|
||||
|
||||
<% if (user) { %>
|
||||
<h1 style="color: #4d18e6;">Welcome, <div class="box-username"><%= user.name %>
|
||||
<div class="avatar"><img src="<%=user.avatar %>"></div>
|
||||
</div>
|
||||
<br>
|
||||
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>
|
||||
|
||||
<br>
|
||||
<% } else { %>
|
||||
<h1>Welcome, Guest!<br>You can press the button to register:
|
||||
<a href="/register/"> <button class="big">REGISTER</button> </a>
|
||||
<h1 style="color: #4d18e6;">Welcome, Guest!<br>You can press the button to register:
|
||||
<a href="/register" class="btn-outline-primary">REGISTER</a>
|
||||
|
||||
</h1>
|
||||
<% } %>
|
||||
<h1>Statistics:</h1>
|
||||
<h1 style="color: #606060;">Statistics:</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<h3>Message count: <b>
|
||||
|
@ -45,9 +47,7 @@
|
|||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<%- include("extra/old_footer") %>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<%- include("extra/old_header", {title: "Login page!" }) %>
|
||||
|
||||
<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>
|
||||
<%- include("extra/meta", {title: "Log in!" }) %>
|
||||
|
||||
|
||||
<body style="text-align: center;">
|
||||
<%- include("extra/navbar") %>
|
||||
|
||||
<h1 style="color: #4d18e6;">Login</h1>
|
||||
|
||||
<form action="/login?redirect=<%= redirect %>" method="post">
|
||||
<input type="text" name="username" placeholder="Username" id="username" required>
|
||||
<input type="password" name="password" placeholder="Password" id="password" required>
|
||||
<input type="submit" value="Login">
|
||||
</form>
|
||||
|
||||
<h1>Login</h1>
|
||||
<hr>
|
||||
<form action="/login?redirect=<%= redirect %>" method="post">
|
||||
<input type="text" name="username" placeholder="Username" id="username" required>
|
||||
<input type="password" name="password" placeholder="Password" id="password" required>
|
||||
<input type="submit" value="Login">
|
||||
</form>
|
||||
|
||||
<%- include("extra/old_footer") %>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,23 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<%- include("extra/old_header", {title: "Register!" }) %>
|
||||
|
||||
<body>
|
||||
<%- include("extra/meta", {title: "Register!" }) %>
|
||||
|
||||
|
||||
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
|
||||
<br>
|
||||
<body style="text-align: center;">
|
||||
<%- 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">
|
||||
|
||||
|
||||
|
@ -30,7 +21,7 @@
|
|||
<input type="submit" value="Register">
|
||||
</form>
|
||||
|
||||
<%- include("extra/old_footer") %>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue