Created the password module

This commit is contained in:
2023-01-08 04:00:47 +01:00
parent fd24a2ca82
commit 1414e1c146
3 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,35 @@
const Joi = require("joi");
const {getLinkById} = require("../../server/controller/link");
module.exports.onClick = async (id, accessId, metaData, controller, request) => {
if (request?.body?.password === metaData.password)
return controller.redirect(metaData.shortenUrl)
controller.locals.meta.title = (await getLinkById(id)).title;
controller.render(__dirname + "/web/password");
}
module.exports.info = {
name: "Link mit Passwort",
icon: "key",
validationSchema: Joi.object({
shortenUrl: Joi.string().max(2500).uri().required(),
password: Joi.string().min(5).max(50).required()
}),
meta: [{
name: "Link-Einstellungen",
type: "default",
fields: {
shortenUrl: {
type: "text",
name: "Zu kürzende URL",
description: "Die zu kürzende (lange) URL"
},
password: {
type: "password",
name: "Passwort",
description: "Das gesicherte Passwort"
}
}
}]
}