#59 Added captcha

master
Keith Irwin 2017-05-08 17:27:45 -04:00
parent d25cb2cc61
commit 6b8c288f22
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
3 changed files with 31 additions and 4 deletions

View File

@ -29,6 +29,9 @@ module.exports = {
googleClientSecret: 'XXXXXXXXX_XXXXXXXXXXXXXX',
// Google maps API key
googleMapsAPI: 'XXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXX'
googleMapsAPI: 'XXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXX',
// reCaptcha API key
recaptcha: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
};

View File

@ -1,6 +1,6 @@
'use strict';
const mw = require('../middleware.js'),
const env = require('../env/env.js'),
router = require('express').Router(),
slug = require('slug'),
xss = require('xss'),
@ -20,7 +20,9 @@ module.exports = router
// Contact
.get('/contact', (req,res)=>{
res.render('contact');
res.render('contact',{
sitekey: env.recaptcha
});
})
.post('/contact', (req,res)=>{
//TODO: Get contact stuff

View File

@ -1,10 +1,32 @@
{% extends 'templates/base.html' %}
{% block title %}{{super()}} | Contact{% endblock %}
{% block head %}
{{super()}}
<script src='https://www.google.com/recaptcha/api.js'></script>
{% endblock %}
{% block main %}
<section class='container'>
<h1>Contact</h1>
<form id='contact-form'>
<button class='g-recaptcha' data-sitekey="{{sitekey}}" data-callback="onSubmit">Submit</button>
</form>
</section>
{% endblock %}
{% endblock %}
{% block javascript %}
{{super()}}
<script type="application/javascript">
/* global $ */
function onSubmit() {
$('#contact-form').submit();
}
</script>
{% endblock %}