more userpages

This commit is contained in:
Flummi 2018-02-20 07:26:06 +01:00
parent 3b34234c2f
commit c6db18f7cb
11 changed files with 35 additions and 13 deletions

View File

@ -1,13 +1,16 @@
$(document).ready(() => {
switch(window.location.pathname.split(/\//)[1]) {
case "v": $("li:eq(1)").addClass("active"); break;
case "u": $("li:eq(3)").addClass("active"); break;
case "v": $("menu > li:eq(1)").addClass("active"); break;
case "u":
$("menu > li:eq(3)").addClass("active");
$("menu > li:eq(3) > ul").removeClass("hidden");
break;
case "a":
$("li:eq(5)").addClass("active");
$("li:eq(5) > ul").removeClass("hidden");
$("menu > li:eq(5)").addClass("active");
$("menu > li:eq(5) > ul").removeClass("hidden");
break;
default:
$("li:eq(0)").addClass("active");
$("menu > li:eq(0)").addClass("active");
break;
}
});

View File

@ -8,17 +8,17 @@ const queries = {
export default express.Router()
.get("/", (req, res) => {
res.render("about");
res.render("about/about");
})
.get("/howto", (req, res) => {
res.render("howto");
res.render("about/howto");
})
.get("/contact", (req, res) => {
res.render("contact");
res.render("about/contact");
})
.get("/statistics", (req, res) => {
db.exec(queries.statistic).then(rows => {
const r = rows[0];
res.render("statistics", { pastes: r.sum });
res.render("about/statistics", { pastes: r.sum });
}).catch(err => console.log(err));
});

View File

@ -4,11 +4,11 @@ import db from "../../lib/sql";
export default express.Router()
.get("/", (req, res) => {
res.render("login");
res.render("user/login");
})
.get("/register", (req, res) => {
res.send("WIP");
res.render("user/register");
})
.get("/lost-password", (req, res) => {
res.send("WIP");
res.render("user/lost-password");
});

View File

@ -20,7 +20,12 @@
<li class="highlight"><a href="/">New paste</a></li>
<li class="highlight"><a href="/v">View pastes</a></li>
<li><hr></li>
<li class="highlight"><a href="/u">Login</a></li>
<li class="highlight"><a href="/u">Login</a>
<ul class="submenu hidden">
<li><a href="/u/register">Register</a></li>
<li><a href="/u/lost-password">Password lost</a></li>
</ul>
</li>
<li><hr></li>
<li class="highlight"><a href="/a">About</a>
<ul class="submenu hidden">

View File

@ -0,0 +1,6 @@
<h1>Lost password</h1>
<p>To request a new password, please enter your email below. You will then receive an email with further instructions.</p>
<p>If you already received your key you can change your password <a href="/u/lost-password/change">here</a>.</p>
<form method="post" action="/u/lost-password" id="lost-password-form">
<p class="label">Email:</p><input type="text" name="email" value=""><input type="submit">
</form>

View File

@ -0,0 +1,8 @@
<h1>Register a new user</h1>
<p>Please make sure your email address is correct. It will be used to send you the activation key required to activate your account.</p>
<form method="post" action="/u/register" id="registration-form">
<p class="label">Email:</p><input type="text" name="email" value=""><br>
<p class="label">Username:</p><input type="text" name="username" value=""><br>
<p class="label">Password:</p><input type="password" name="password"><br>
<input type="submit">
</form>