Explorar o código

redirect to login if anonymous link creation is disabled

Pouria Ezzati hai 1 ano
pai
achega
40c65b4e59
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      server/handlers/renders.handler.js

+ 4 - 0
server/handlers/renders.handler.js

@@ -9,6 +9,10 @@ const env = require("../env");
 **/
 
 async function homepage(req, res) {
+  if (env.DISALLOW_ANONYMOUS_LINKS && !req.user) {
+    res.redirect("/login");
+    return;
+  }
   res.render("homepage", {
     title: "Modern open source URL shortener",
   });