72 lines
1.6 KiB
JavaScript
72 lines
1.6 KiB
JavaScript
|
import { Router } from "express";
|
||
|
const router = Router();
|
||
|
|
||
|
//todo: fix jank
|
||
|
|
||
|
router.get('/login', (req, res, next) => {
|
||
|
res.ctx.mainPage = 'hub'
|
||
|
res.ctx.mainCtx = {
|
||
|
title: "Log in",
|
||
|
message: 'Log into an existing account.',
|
||
|
action: "/api/form/you/login",
|
||
|
inputs: [
|
||
|
{
|
||
|
"key": "Username",
|
||
|
"type": "text",
|
||
|
"name": "user",
|
||
|
"default": ""
|
||
|
},
|
||
|
{
|
||
|
"key": "Password",
|
||
|
"type": "password",
|
||
|
"name": "pass",
|
||
|
"default": ""
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
next();
|
||
|
})
|
||
|
|
||
|
router.get('/logout', (req, res, next) => {
|
||
|
res.ctx.mainPage = 'form'
|
||
|
res.ctx.mainCtx = {
|
||
|
title: "Log out",
|
||
|
message: 'Are you sure?',
|
||
|
action: "/api/form/you/logout",
|
||
|
inputs: []
|
||
|
}
|
||
|
next();
|
||
|
})
|
||
|
|
||
|
|
||
|
router.get('/new', (req, res, next) => {
|
||
|
res.ctx.mainPage = 'form'
|
||
|
res.ctx.mainCtx = {
|
||
|
title: "Register",
|
||
|
message: 'Create an account and join the community!',
|
||
|
action: "/api/form/you/new",
|
||
|
inputs: [
|
||
|
{
|
||
|
"key": "Username",
|
||
|
"type": "text",
|
||
|
"name": "user",
|
||
|
"default": ""
|
||
|
},
|
||
|
{
|
||
|
"key": "Password",
|
||
|
"type": "password",
|
||
|
"name": "pass",
|
||
|
"default": ""
|
||
|
},
|
||
|
{
|
||
|
"key": "Password (again)",
|
||
|
"type": "password",
|
||
|
"name": "pass2",
|
||
|
"default": ""
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
next();
|
||
|
})
|
||
|
|
||
|
export default router;
|