Browse Source

only displaying email if it contains something

2015
joates 8 years ago
parent
commit
453bbfa09b
  1. 2
      base.html
  2. 5
      html/index.html
  3. 3
      server.js

2
base.html

@ -31,7 +31,7 @@
<input type="text" name="email">
<span class="help-block">we'll send you info about future events</span>
<label class="checkbox text-info">
<input type="checkbox" name="paris"> Nov 2014 (Paris)
<input type="checkbox" name="paris"> Paris Nov.2014?
</label>
<button type="submit" class="btn">Send</button>
</fieldset>

5
html/index.html

@ -23,14 +23,15 @@
<br /><br />
<ul class="nav nav-list">
<form method="GET" action="http://clevo:8000/email">
<!-- WARNING: This only works for development system (localhost) -->
<form method="GET" action="http://localhost:8000/email">
<fieldset>
<legend>JOIN US</legend>
<label class="text-info">Enter your email..</label>
<input type="text" name="email">
<span class="help-block">we'll send you info about future events</span>
<label class="checkbox text-info">
<input type="checkbox" name="paris"> Nov 2014 (Paris)
<input type="checkbox" name="paris"> Paris Nov.2014?
</label>
<button type="submit" class="btn">Send</button>
</fieldset>

3
server.js

@ -14,7 +14,8 @@ function handler(req, res) {
if (/^\/email\?/.test(req.url)) {
var params = require('url').parse(req.url, true)
console.log('got email:', params.query)
if (params && params.query.email) // @TODO: validate input
console.log('got email:', params.query)
res.statusCode = 302
res.setHeader('Location', '/')
return res.end()

Loading…
Cancel
Save