#59 Added captcha
parent
d25cb2cc61
commit
6b8c288f22
|
@ -29,6 +29,9 @@ module.exports = {
|
|||
googleClientSecret: 'XXXXXXXXX_XXXXXXXXXXXXXX',
|
||||
|
||||
// Google maps API key
|
||||
googleMapsAPI: 'XXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXX'
|
||||
googleMapsAPI: 'XXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXX',
|
||||
|
||||
// reCaptcha API key
|
||||
recaptcha: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
|
||||
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Reference in New Issue