Added U2F Support for YubiKey
This commit is contained in:
@ -8,6 +8,7 @@ function loadStatic() {
|
||||
let html = readFileSync("./views/out/login/login.html").toString();
|
||||
template = handlebars.compile(html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Benchmarks (5000, 500 cuncurrent)
|
||||
* Plain:
|
||||
@ -26,7 +27,6 @@ function loadStatic() {
|
||||
* - prod 6sec
|
||||
*/
|
||||
|
||||
|
||||
export default function GetLoginPage(__: typeof i__): string {
|
||||
if (config.dev) {
|
||||
loadStatic()
|
||||
|
@ -13,10 +13,11 @@ import Client from "../models/client";
|
||||
import { Logging } from "@hibas123/nodelogging";
|
||||
import Stacker from "../api/middlewares/stacker";
|
||||
import { UserMiddleware, GetUserMiddleware } from "../api/middlewares/user";
|
||||
import GetUserPage from "./user";
|
||||
|
||||
Handlebars.registerHelper("appname", () => config.core.name);
|
||||
|
||||
const cacheTime = moment.duration(1, "month").asSeconds();
|
||||
const cacheTime = config.dev ? moment.duration(1, "month").asSeconds() : 10;
|
||||
|
||||
const ViewRouter: IRouter<void> = Router();
|
||||
ViewRouter.get("/", UserMiddleware, (req, res) => {
|
||||
@ -40,6 +41,11 @@ ViewRouter.get("/admin", GetUserMiddleware(false, true), (req: Request, res, nex
|
||||
res.send(GetAdminPage(req.__))
|
||||
})
|
||||
|
||||
ViewRouter.get("/user", Stacker(GetUserMiddleware(false, true), (req, res) => {
|
||||
res.setHeader("Cache-Control", "public, max-age=" + cacheTime);
|
||||
res.send(GetUserPage(req.__));
|
||||
}));
|
||||
|
||||
ViewRouter.get("/auth", Stacker(GetUserMiddleware(false, true), async (req, res) => {
|
||||
let { scope, redirect_uri, state, client_id }: { [key: string]: string } = req.query;
|
||||
const sendError = (type) => {
|
||||
@ -85,7 +91,7 @@ if (config.dev) {
|
||||
res.send(GetAuthPage(req.__, "Test 05265", [
|
||||
{
|
||||
name: "Access Profile",
|
||||
description: "It allows the application to know who you are. Required for all applications.",
|
||||
description: "It allows the application to know who you are. Required for all applications. And a lot of more Text, because why not? This will not stop, till it is multiple lines long and maybe kill the layout, so keep reading as long as you like, but I promise it will get boring after some time. So this should be enougth.",
|
||||
logo: logo
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user