home & login page files
This commit is contained in:
parent
b06696f6ff
commit
769f412ecc
28
files/2fa.html
Normal file
28
files/2fa.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!--
|
||||
This file isn't automatically served anywhere, it's just here to populate the directory
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>2 FA</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="main-container">
|
||||
|
||||
<h2>Verification</h2>
|
||||
<form action="/api/login/verify" method="post">
|
||||
<label for="code">Code: </label>
|
||||
<input id="code" name="code" type="password" required><br />
|
||||
<input type="submit" value="Verify">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
30
files/finalise.html
Normal file
30
files/finalise.html
Normal file
@ -0,0 +1,30 @@
|
||||
<!--
|
||||
This file isn't automatically served anywhere, it's just here to populate the directory
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Finalise Account</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="main-container">
|
||||
|
||||
<h2>Finalise account registration</h2>
|
||||
<form action="/api/register/finalise" method="post">
|
||||
<label for="username">Username (required): </label>
|
||||
<input id="username" name="username" type="text" autocomplete="off" required><br />
|
||||
<label for="password">Password (not required): </label>
|
||||
<input id="password" name="password" type="password"><br />
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
30
files/home.html
Normal file
30
files/home.html
Normal file
@ -0,0 +1,30 @@
|
||||
<!--
|
||||
This file isn't automatically served anywhere, it's just here to populate the directory
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Home</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="main-container">
|
||||
|
||||
<h2>Add 2FA</h2>
|
||||
<img src="/api/user/2fa" />
|
||||
|
||||
<form action="/api/user/2fa/verify" method="post">
|
||||
<label for="code">2FA code</label>
|
||||
<input type="text" id="code" name="code">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
24
src/server/endpoints/pages/Home.js
Normal file
24
src/server/endpoints/pages/Home.js
Normal file
@ -0,0 +1,24 @@
|
||||
const { Endpoint } = require("../../interfaces");
|
||||
|
||||
class Home extends Endpoint {
|
||||
|
||||
constructor (server) {
|
||||
|
||||
super(server, {
|
||||
name: 'home',
|
||||
path: '/home'
|
||||
});
|
||||
|
||||
this.methods = [
|
||||
[ 'get', this.home.bind(this), [ server.authenticator.authenticateRedirect ]]
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
async home (req, res) {
|
||||
res.sendFile('/home.html', { root: this.server.serveFiles });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Home;
|
40
src/server/endpoints/pages/Login.js
Normal file
40
src/server/endpoints/pages/Login.js
Normal file
@ -0,0 +1,40 @@
|
||||
const { Endpoint } = require("../../interfaces");
|
||||
|
||||
class LoginPage extends Endpoint {
|
||||
|
||||
constructor (server) {
|
||||
super(server, {
|
||||
name: 'loginpage',
|
||||
path: '/login'
|
||||
});
|
||||
|
||||
this.methods = [
|
||||
[ 'get', this.login.bind(this) ]
|
||||
];
|
||||
this.subpaths = [
|
||||
[ '/fail', 'get', this.failed.bind(this) ],
|
||||
[ '/finalise', 'get', this.finalise.bind(this) ],
|
||||
[ '/verify', 'get', this.verify.bind(this) ],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
login (req, res) {
|
||||
res.sendFile('login.html', { root: this.server.serveFiles });
|
||||
}
|
||||
|
||||
finalise (req, res) { // Finalise account registration
|
||||
res.sendFile('finalise.html', { root: this.server.serveFiles });
|
||||
}
|
||||
|
||||
verify (req, res) { // Finalise account registration
|
||||
res.sendFile('2fa.html', { root: this.server.serveFiles });
|
||||
}
|
||||
|
||||
failed (req, res) {
|
||||
res.status(401).send('Login failed');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = LoginPage;
|
Loading…
Reference in New Issue
Block a user