fixing the forms again
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
module Merged
|
||||
class FormController < MergedController
|
||||
class FormController < ::ApplicationController
|
||||
|
||||
def sendit
|
||||
def post
|
||||
@section = Section.find( params[:section_id] )
|
||||
@errors = { }
|
||||
return if bot_alert
|
||||
check_maths
|
||||
verify_data
|
||||
if( @errors.length > 0)
|
||||
render :form
|
||||
render "merged/form/form"
|
||||
else
|
||||
dispatch_form_data( )
|
||||
redirect_to main_app.root_url , notice: @section.option("ok_message")
|
||||
@ -36,7 +36,6 @@ module Merged
|
||||
end
|
||||
def check_option(card , value)
|
||||
return unless value.blank?
|
||||
puts "Checking #{card.header} #{value}"
|
||||
compulsory = card.option("compulsory") != "no"
|
||||
return unless compulsory
|
||||
# check different types
|
||||
@ -48,7 +47,7 @@ module Merged
|
||||
def check_maths
|
||||
key = params[:bot_fudder].to_i / 2
|
||||
if( (2*key + 1).to_s != params[:challenge])
|
||||
@errors[:challenge] = "Check the maths #{params[:challenge]}"
|
||||
@errors[:challenge] = "Check the anti bot maths, it wasn't: #{params[:challenge]}"
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user