From f98eb6c9472d1c2a24f7dfb2ed948bdbc627b59a Mon Sep 17 00:00:00 2001 From: bennysghost Date: Wed, 15 Apr 2026 00:11:17 -0700 Subject: [PATCH] redirect to login if user is not authenticated and trying to access an authenticated route --- route/mnp.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/route/mnp.js b/route/mnp.js index a9ce63a..f4138ea 100644 --- a/route/mnp.js +++ b/route/mnp.js @@ -524,6 +524,7 @@ router.post('/matches/:match_id/players/add',function(req,res) { // /mymatch takes the user directly to their most recent match. router.get('/mymatch', function(req,res) { + if (!req.user.key) { return res.redirect('/login?redirect_url=/mymatch'); } var ukey = req.user.key || 'ANON'; var match = matches.uget(ukey); @@ -539,6 +540,7 @@ router.get('/mymatch', function(req,res) { // /myteam takes the user directly to their most recent team from stats. router.get('/myteam', function(req,res) { + if (!req.user.key) { return res.redirect('/login?redirect_url=/myteam'); } const season = seasons.get(); var ukey = req.user.key || 'ANON'; var myTeam = '';