@@ -24,9 +24,22 @@ router.post('/invite', function(req, res) {
if (err) { return res.send('Error:' + err); }
body = JSON.parse(body);
if (body.ok) {
- res.send('Success! Check "'+ req.body.email +'" for an invite from Slack.');
+ res.render('result', {
+ community: config.community,
+ message: 'Success! Check "'+ req.body.email +'" for an invite from Slack.'
+ });
} else {
- res.send('Failed! ' + body.error)
+ var error = body.error;
+ if (error === 'already_invited') {
+ error = 'You are already invited.'
+ } else if (error === 'invalid_email') {
+ error = 'The email you entered is an invalid email.'
+ }
+
+ message: 'Failed! ' + error
}
});
@@ -1,17 +1,15 @@
doctype html
html
head
+ meta(http-equiv="Content-Type", content="text/html; charset=utf-8")
+ meta(name="viewport", content="width=device-width, initial-scale=1")
title Join the #{community} community on Slack!
- style.
- body {
- padding: 50px;
- font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
- }
- input {
- font-size: 24px;
- width: 400px;
+ link(href="css/style.css", rel="stylesheet", type="text/css")
+ link(href="http://fonts.googleapis.com/css?family=Lato:300,400,700,900,700italic|Open+Sans:700italic,400,600,300,700,800", rel="stylesheet", type="text/css")
body
- h1= message
- h2= error.status
- pre #{error.stack}
+ #wrapper
+ .main
+ .header
+ h1= message
+ h2= error.status
+ pre #{error.stack}
@@ -0,0 +1,15 @@
+doctype html
+html
+ head
+ title Join the #{community} community on Slack!
+ body
+ h1
+ strong #{community}
+ h2= message