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.
});
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);
--- /dev/null
+<!DOCTYPE html>
+<html>
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>ZOMBO</title>
+ <link href="/zombo.css" rel="stylesheet" type="text/css">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="HandheldFriendly" content="true">
+</head>
+
+<body>
+ <div id="content">
+
+ <div>
+ <img src="/doctor-profile.png" style="float:left; max-width:150px">
+ <h1>Error</h1>
+
+ <p>
+ I'm sorry. I can't let a companion with no name enter the TARDIS.
+ </p>
+
+ <p>
+ But you can go <a href="/">back to the top</a> and then come
+ back here once you've named yourself.
+ </p>
+
+ </div>
+
+ </div>
+</body>
+</html>