Modified: trunk/app/controllers/users_controller.rb (2280 => 2281)
--- trunk/app/controllers/users_controller.rb 2009-10-07 01:15:48 UTC (rev 2280)
+++ trunk/app/controllers/users_controller.rb 2009-10-08 16:11:04 UTC (rev 2281)
@@ -132,6 +132,15 @@
# POST /users
def create
+
+ # check that captcha was entered correctly
+
+ if !captcha_valid?(params[:validation][:captcha_id], params[:validation][:captcha_validation])
+ flash.now[:error] = 'Verification text was not entered correctly - please try again.'
+ render :action ="" 'new'
+ return
+ end
+
if params[:user][:username] && params[:user][:password] && params[:user][:password_confirmation]
params[:user].delete("openid_url") if params[:user][:openid_url] # strip params[:user] of it's openid_url if username and password is provided
end
Modified: trunk/app/views/users/new.rhtml (2280 => 2281)
--- trunk/app/views/users/new.rhtml 2009-10-07 01:15:48 UTC (rev 2280)
+++ trunk/app/views/users/new.rhtml 2009-10-08 16:11:04 UTC (rev 2281)
@@ -21,9 +21,31 @@
However, usernames and registered email addresses (different to profile email addresses) are not exposed.
</div>
-<br/>
+<br />
+<br />
<% form_for(:user, :url ="" users_path) do |f| %>
+
+ <center>
+ <h2>Anti-spam verification</h2>
+ <table style="margin-top: 2em;">
+ <tr>
+ <td>
+ <% c = prepare_captcha :type => :image -%>
+ <%= captcha_image_tag c -%>
+ </td>
+ <td style="vertical-align: top;">
+ <%= captcha_hidden_field c, 'validation' -%>
+ <%= captcha_label 'validation', 'Type in the text from the image on the left:' -%><br/>
+ <%= captcha_text_field 'validation', :size => 40 -%>
+ </td>
+ </tr>
+ </table>
+ </center>
+
+ <br />
+ <br />
+
<div class="fold">
<div class="foldTitle">
Register with a Username and Password