diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/comments_controller.rb | 6 | ||||
-rw-r--r-- | app/views/comments/_form.html.haml | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 9413339..31fe411 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb | |||
@@ -5,6 +5,12 @@ class CommentsController < ApplicationController | |||
5 | raise ActiveRecord::RecordNotFound unless @blog | 5 | raise ActiveRecord::RecordNotFound unless @blog |
6 | raise ActiveRecord::RecordNotFound unless @blog.published | 6 | raise ActiveRecord::RecordNotFound unless @blog.published |
7 | 7 | ||
8 | unless verify_recaptcha | ||
9 | flash.alert = "Error posting comment." | ||
10 | render "blogs/show" | ||
11 | return | ||
12 | end | ||
13 | |||
8 | @comment = @blog.comments.new(comment_params) | 14 | @comment = @blog.comments.new(comment_params) |
9 | @comment.request_ip = request.ip | 15 | @comment.request_ip = request.ip |
10 | @comment.user_agent = request.user_agent | 16 | @comment.user_agent = request.user_agent |
diff --git a/app/views/comments/_form.html.haml b/app/views/comments/_form.html.haml index 13a0903..12692c2 100644 --- a/app/views/comments/_form.html.haml +++ b/app/views/comments/_form.html.haml | |||
@@ -24,6 +24,9 @@ | |||
24 | .comment-website-field.comment-field | 24 | .comment-website-field.comment-field |
25 | .comment-field-label= f.label :website, "Website (Optional)" | 25 | .comment-field-label= f.label :website, "Website (Optional)" |
26 | .comment-field-input= f.text_field :website, type: :url | 26 | .comment-field-input= f.text_field :website, type: :url |
27 | .comment-website-field.comment-field | ||
28 | .comment-field-label | ||
29 | .comment-field-input= recaptcha_tags | ||
27 | .comment-submit-button.comment-field | 30 | .comment-submit-button.comment-field |
28 | .comment-field-label | 31 | .comment-field-label |
29 | .comment-field-input= f.submit "Post" | 32 | .comment-field-input= f.submit "Post" |