Skip to content

Commit

Permalink
Adjusted signup BAN delay when fixing form
Browse files Browse the repository at this point in the history
If a user filled a form, missed a field, and
corrected the mistake too quickly, they could
be banned. So we keep the timestamp of the original
form during the subsequent renders of the form.
  • Loading branch information
prioux committed Feb 11, 2025
1 parent fd734c2 commit 21cb53b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions BrainPortal/app/controllers/signups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def create #:nodoc:
return
end

# Validation failed, return to form
if ! @signup.save
@auth_spec = form_generated_at_int # keep old form_generated time
render :action => :new
return
end
Expand Down
2 changes: 1 addition & 1 deletion BrainPortal/app/views/signups/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<%= form_for @signup, :url => {:action => (@signup.new_record? ? "create" : "update"), :id => @signup.id} do |f| %>
<%= error_messages_for @signup %>
<%= hidden_field_tag :auth_spec, Time.now.to_i.to_s %>
<%= hidden_field_tag(:auth_spec, (@auth_spec.to_s || Time.now.to_i.to_s)) %>

<div class="generalbox">
<p class="warning"> Fields with an asterisk (*) are mandatory.</p>
Expand Down

0 comments on commit 21cb53b

Please sign in to comment.