Skip to content
Snippets Groups Projects
Commit c6ccf3ab authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

updated logout behavior

parent e977a55e
No related branches found
No related tags found
No related merge requests found
......@@ -25,13 +25,19 @@ router.get("/remove", (req, res) => {
// Check if a redirection URL is supplied
let url = req.query.url;
if (!url && typeof req.headers.referer !== "undefined") {
url = req.headers.referer;
}
if (url) {
let parsed_url = new URL(url);
if (parsed_url.hostname !== req.hostname) {
url = "/";
if (
parsed_url.hostname !== req.hostname ||
parsed_url.pathname.match(/\/key\/.*/)
) {
url = `${res.baseDir}/key/enter`;
}
} else {
url = "/";
url = `${res.baseDir}/key/enter`;
}
res.redirect(url);
......@@ -179,7 +185,7 @@ router.get("/:key/qr.png", (req, res) => {
let QRCode = require("qrcode");
res.header({
"Content-Type": "image/png",
"Content-Disposition": `inline; filename=metager_key.png`
"Content-Disposition": `inline; filename=metager_key.png`,
});
QRCode.toFileStream(res, metager_url, {
errorCorrectionLevel: "H",
......
......@@ -84,7 +84,7 @@
<li><a href="<%= baseDir %>/help/faq"><%= req.t("leftnav.help", { ns: 'pageheader'}) _%></a></li>
<li class="whitespace"></li>
<li><a href="<%= baseDir _%>/key/enter"><%= req.t("rightnav.manage", { ns: 'pageheader'}) _%></a></li>
<%_ if((typeof cookies !== "undefined" && typeof cookies.key !== "undefined") || typeof key !== "undefined") { _%>
<%_ if((typeof req.cookies !== "undefined" && typeof req.cookies.key !== "undefined") || typeof key !== "undefined") { _%>
<li>|</li>
<li><a href="<%= baseDir _%>/key/remove" class="" id="key-remove"><%= req.t("rightnav.logout", { ns: 'pageheader'}) _%></a></li>
<%_ } else { _%>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment