From: Carl Worth Date: Thu, 22 Dec 2022 03:53:29 +0000 (-0800) Subject: Add an error page if the user has no name set X-Git-Url: https://git.cworth.org/git?p=zombocom-ai;a=commitdiff_plain;h=8443e4c644efeb5a3d8e21cf5502bc46381270cb Add an error page if the user has no name set Since we're keying off of the name to make sure everyone gets different words, we need to force them to set a name before playing the game. --- diff --git a/index.js b/index.js index 13ed7f6..cb46c20 100644 --- a/index.js +++ b/index.js @@ -133,7 +133,11 @@ app.get('/index.html', (req, res) => { }); function tardis_app(req, res) { - res.sendFile(__dirname + '/tardis.html'); + if (! req.session.name) { + res.sendFile(__dirname + '/tardis-error.html'); + } else { + res.sendFile(__dirname + '/tardis.html'); + } } app.get('/tardis', tardis_app); diff --git a/tardis-error.html b/tardis-error.html new file mode 100644 index 0000000..b374e81 --- /dev/null +++ b/tardis-error.html @@ -0,0 +1,33 @@ + + + + + + ZOMBO + + + + + + + +
+ +
+ +

Error

+ +

+ I'm sorry. I can't let a companion with no name enter the TARDIS. +

+ +

+ But you can go back to the top and then come + back here once you've named yourself. +

+ +
+ +
+ +