diff --git a/files/2fa.html b/files/2fa.html new file mode 100644 index 0000000..7f9bb8a --- /dev/null +++ b/files/2fa.html @@ -0,0 +1,28 @@ + + + + + + + + 2 FA + + + + +
+ +

Verification

+
+ +
+ +
+ +
+ + + + \ No newline at end of file diff --git a/files/finalise.html b/files/finalise.html new file mode 100644 index 0000000..9acd4b3 --- /dev/null +++ b/files/finalise.html @@ -0,0 +1,30 @@ + + + + + + + + Finalise Account + + + + +
+ +

Finalise account registration

+
+ +
+ +
+ +
+ +
+ + + + \ No newline at end of file diff --git a/files/home.html b/files/home.html new file mode 100644 index 0000000..610f0a4 --- /dev/null +++ b/files/home.html @@ -0,0 +1,30 @@ + + + + + + + + Home + + + + +
+ +

Add 2FA

+ + +
+ + + +
+ +
+ + + + \ No newline at end of file diff --git a/files/index.html b/files/login.html similarity index 100% rename from files/index.html rename to files/login.html diff --git a/src/server/endpoints/pages/Home.js b/src/server/endpoints/pages/Home.js new file mode 100644 index 0000000..67a1259 --- /dev/null +++ b/src/server/endpoints/pages/Home.js @@ -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; \ No newline at end of file diff --git a/src/server/endpoints/pages/Login.js b/src/server/endpoints/pages/Login.js new file mode 100644 index 0000000..ed6df37 --- /dev/null +++ b/src/server/endpoints/pages/Login.js @@ -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; \ No newline at end of file