1
0
Fork 0

only displaying email if it contains something

2015
joates 10 years ago
parent 496eaa2f04
commit 453bbfa09b

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

@ -23,14 +23,15 @@
<br /><br /> <br /><br />
<ul class="nav nav-list"> <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> <fieldset>
<legend>JOIN US</legend> <legend>JOIN US</legend>
<label class="text-info">Enter your email..</label> <label class="text-info">Enter your email..</label>
<input type="text" name="email"> <input type="text" name="email">
<span class="help-block">we'll send you info about future events</span> <span class="help-block">we'll send you info about future events</span>
<label class="checkbox text-info"> <label class="checkbox text-info">
<input type="checkbox" name="paris"> Nov 2014 (Paris) <input type="checkbox" name="paris"> Paris Nov.2014?
</label> </label>
<button type="submit" class="btn">Send</button> <button type="submit" class="btn">Send</button>
</fieldset> </fieldset>

@ -14,7 +14,8 @@ function handler(req, res) {
if (/^\/email\?/.test(req.url)) { if (/^\/email\?/.test(req.url)) {
var params = require('url').parse(req.url, true) 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.statusCode = 302
res.setHeader('Location', '/') res.setHeader('Location', '/')
return res.end() return res.end()

Loading…
Cancel
Save